Hello to all, welcome to therichpost.com. In this post, I will tell you, Wp_query display woocommerce product based on category name.
Here is the code for Wp_query display woocommerce product based on category name and you can this code any of your wordpress theme’s template file:
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 10,
'product_cat' => 'hoodies'
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
global $product;
echo '<br /><a href="'.get_permalink().'">' . woocommerce_get_product_thumbnail().' '.get_the_title().'</a>';
endwhile;
wp_reset_query();
?>
If you have any query related to wordpress or this post, then please do comment or email me.
