Wednesday , 26 July 2017
Home » Wordpress » WooCommerce » [WooCommerce] How to Write Custom Products Listing Loop
[WooCommerce] How to Write Custom Products Listing Loop

[WooCommerce] How to Write Custom Products Listing Loop

Hi Friends,

I am working with WooCommerce project for my client and i need to show products listing loop with pagination. I was searching for how to write custom products listing loop in WooCommerce and after a bit research, i found a way. Here i am sharing a code with you.

Custom WooCommerce Product Listing Loop

WooCommerce is using “product” as custom post type so you can write WP_Query with custom post type parameter as “product”. Below is the code.


// Write custom query as per your needs
$args = array( 'post_type' => 'product' );
$products = new WP_Query( $args );

while ( $products->have_posts() ) : $products->the_post(); 

 <a href="<?php echo get_permalink( $products->post->ID ) ?>">
 <?php the_title(); ?>

endwhile; wp_reset_query(); // Reset WP Query

Isn’t it easy to list all products as per your needs and in specific area of your web page ? Looking for How to Write Custom Products Listing Loop in WooCommerce, WooCommerce Products listing loop custom query, custom query to get products in WooCommerce than this is perfect solution for you.

Plugin by: PHP Freelancer

About Rakshit Patel

I am PHP Freelancer, Rakshit Patel working as PHP Programmer India. I have developed this site to share my knowledge, thoughts and experience during the development of projects. We are group of developers working together. If you want to hire us for any PHP related work, you can reach me via Email, Phone or Chat.

Leave a Reply

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


Notify me of followup comments via e-mail. You can also subscribe without commenting.