I was wondering if someone could help me. I am trying to display featured products using a custom loop. Before WooCommerce 3 I used following loop, which worked perfectly:

<?php

$args = [  
    'post_type' => 'product',  
    'meta_key' => '_featured',  
    'meta_value' => 'yes',  
    'posts_per_page' => 6  
];  

$featured_query = new WP_Query( $args );  

if ($featured_query->have_posts()) :   

    while ($featured_query->have_posts()) :   

        $featured_query->the_post();  

        $product = get_product( $featured_query->post->ID );  

        // here is my output 

    endwhile;  

endif;  

wp_reset_query();

?>

Since the update to WooCommerce 3, the meta_key _featured does not exist anymore. I figured out that featured products are using the new product_visibility taxonomy instead of meta now.
Unfortunately I do not know how to change my loop to output the featured products now. I want to use custom styles, so I do not want to use a shortcode. Can anyone help me?

Read more here: Display featured products through custom loop in WooCommerce 3


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: