Home Forums General Issues Post type = product per single product Reply To: Post type = product per single product

  • The code is working exactly as you describe and it seems that is what it is meant to do.

    The first part

                $meta_query  = WC()->query->get_meta_query();
                $tax_query   = WC()->query->get_tax_query();
                $tax_query[] = array(
                    'taxonomy' => 'product_visibility',
                    'field'    => 'name',
                    'terms'    => 'featured',
                    'operator' => 'IN',
                $args = array(
                    'post_type'           => 'product',
                    'post_status'         => 'publish',
                    'orderby' => 'post_date',
                    'order' => 'DSC',
                    'posts_per_page'      => 1,
                    'meta_query'          => $meta_query,
                    'tax_query'           => $tax_query,
                <div class="row">
                    $featured_query = new WP_Query( $args );

    This is getting a 1 product that has the “visibility” taxonomy term of “feature_product” set. This will always get the same post. The the rest of the code is getting the featured product as set on this product.

    I don’t know where your code is running or in what template, but the above code should likely be removed and somewhere in the single product template you should be getting the fields from the current product being shown rather than the above. The code you posted would be useless for doing this and if that’s not what should be happening should probably all be removed.