Solution for : Woocommerce code get list products
Below code will list all product thumbnails and names along with their links to product page. change the category name and posts_per_page as per your requirement
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | $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(); |
No comments:
Post a Comment