Show Featured WooCommerce Products

Quick Summary
- A WP_Query with a tax_query for the featured term of product_visibility lists featured WooCommerce products anywhere in a template.
- wc_get_template_part() loads content-product.php so products match your shop page; wrap the loop in a ul element with the products class.
- Inside page content, the products shortcode with visibility set to featured shows featured products without any PHP.
This snippet lists featured WooCommerce products anywhere in a theme template, for example in a section of a custom home page. Featured products are the ones marked with the star in Products > All Products.
Place the code in the template file of your child theme where the products should appear.
$args = array(
'post_type' => 'product',
'posts_per_page' => 12,
'tax_query' => array(
array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'featured',
),
),
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
wc_get_template_part( 'content', 'product' );
endwhile;
} else {
echo __( 'No products found' );
}
wp_reset_postdata();How it works
- WooCommerce stores the featured flag as the
featuredterm of its internalproduct_visibilitytaxonomy, so thetax_queryasksWP_Queryfor products that have that term. posts_per_pagesets how many products are shown. Change12to the number you need.wc_get_template_part( 'content', 'product' )loads WooCommerce’scontent-product.phptemplate, so each product looks the same as on your shop page.- If no product is featured, the
elsebranch prints No products found. wp_reset_postdata()restores the main query’s post afterwards, so the rest of the template keeps working as expected.
Tips
content-product.phpoutputs each product as an<li>, so wrap the loop in<ul class="products">to get valid markup that matches the structure of the shop page.- If you only need featured products inside a page’s content, WooCommerce’s
[products visibility="featured"]shortcode shows them without any PHP.
Related articles
- showing products from one category by ID: the same WP_Query approach with a product_cat tax_query
- category image tiles for a home page section: pairs well with a featured products row
- featured blog posts on the home page: the same idea for regular posts
