How to display featured products WooCommerce

WooCommerce has introduce number of useful shortcodes to allow add WooCommerce related content within posts and pages or anywhere on the site. There is also a shortcode available for display Featured Products

[featured_products limit="8" columns="4"]

You can also use Product Attributes to update according to your theme design etc.

Product Attributes

limit – The number of products to display
columns – The number of columns to display

How to set Product as featured in Woocommerce

After logged into WordPress simply navigate to the “Products->All Products”, you’ll notice that there is a column containing stars as in screenshot below:

If star is Filled it’s mean it’s featured or if it’s only outline not filled then it’s not featured. To set a product to the featured products list you simply click the star and vice versa to remove.

Display Featured Products without shortcode

$args_featured = array(  
    'post_type' => 'product',  
    'meta_key' => '_featured',  
    'meta_value' => 'yes',  
    'posts_per_page' => 1  
$show_featured_query = new WP_Query( $args_featured );  
if ($show_featured_query->have_posts()) :   
    while ($show_featured_query->have_posts()) :   
        $product = get_product( $show_featured_query->post->ID );  
        // Output product information here  
wp_reset_query(); // Remember to reset  

Leave a Reply

Your email address will not be published. Required fields are marked *