Best Ways to Create WooCommerce Products Loop - TIPsoont

How to Create WooCommerce Products Loop | With Plugin and Without Plugin

2 Ways to Create WooCommerce Products Loop

Discussing Customization like e commerce Products loop or others is essential Because Nowadays, WooCommerce is one of the most popular platforms where you can easily create your website. And a bunch of customization opportunities is what makes it popular. 

For example, you can customize the add-to-cart text, size, or button color. 

Meanwhile, your product page is not the only page where users will interact and purchase. It is a loop of interconnected products to improve the user experience. 

This is why a WooCommerce product loop is all you need.

Don’t worry; we will discuss how to make a custom WooCommerce product loop in today’s guide.

All you need is to stick with us till the end. 

What is a Product Loop?

It is a list of products appearing on the WooCommerce store page. However, the code that produces those products is known as the product loop.

Simply put, a product loop is a collection of products or items displayed under the category or archive section so customers can visit. 

It greatly helps a web developer or designer to enhance user experience and the site interface.

However, creating a custom product loop is also simpler. Even a non-coding person can do that with ease.

How to Make a WooCommerce Product Loop?

A slight change in the product page can make the user experience tremendous. 

For example, disabling product zoom, if not needed, or making a custom product loop are helpful techniques to make the site look appealing.

Let’s dive deeper and discover how to make a custom WooCommerce product loop. 

Using a Plugin 

However, the process of adding a custom WooCommerce product loop using a code is also easier. 

Still, a beginner can easily get confused. 

That’s why, to make WordPress more accessible for you, specific third-party plugins are also available. 

  1. Login to your WordPress dashboard using the site credentials.
  2. Initiate the process by activating and installing the plugin. And the one we recommend is WooCommerce Elementor Pro. 
  3. To get the WooCommerce product loop functionality, you need a pro version of it. 
  4. Next, activate the product loop through Elementor > Settings > General. 
  5. Under this section, you will find an option of “Woo Archive Loop Content Templet.” Simply check this box.
  6. It’s time to create a new product loop using Products > WooTemplate.
  7. Click on the “add product loop content template.”
  8. Give your loop a name and click on edit with Elementor to start working.
  9. Now customize the loop as per your site requirements.
  10. Once you finish the settings, go to WooCommerce > Template Builder.
  11. You must choose your customized template to finish assigning the WooCommerce product loop here.

That’s all you need to create a custom WooCommerce product loop.

Remember to check the results from the site to see if you are satisfied. 

Using WP_Query

Before we dig into this method, it’s worth mentioning that you must have a coding background to proceed with these codes, as a simple error could cause your website. 

Another drawback of using this method is that any update in WooCommerce will likely break your code. 

  1. Initiate the process by creating a custom page template
  2. Next, use WP_Query and create a for each loop for products.
  3. Copy the below-mentioned code and paste it into your function.php file.

Source: GitHub

  if(!function_exists(‘wc_get_products’)) {    return;  }
  $paged                   = (get_query_var(‘paged’)) ? absint(get_query_var(‘paged’)) : 1;  $ordering                = WC()->query->get_catalog_ordering_args();  $ordering[‘orderby’]     = array_shift(explode(‘ ‘, $ordering[‘orderby’]));  $ordering[‘orderby’]     = stristr($ordering[‘orderby’], ‘price’) ? ‘meta_value_num’ : $ordering[‘orderby’];  $products_per_page       = apply_filters(‘loop_shop_per_page’, wc_get_default_products_per_row() * wc_get_default_product_rows_per_page());
  $featured_products       = wc_get_products(array(    ‘meta_key’             => ‘_price’,    ‘status’               => ‘publish’,    ‘limit’                => $products_per_page,    ‘page’                 => $paged,    ‘featured’             => true,    ‘paginate’             => true,    ‘return’               => ‘ids’,    ‘orderby’              => $ordering[‘orderby’],    ‘order’                => $ordering[‘order’],  ));
  wc_set_loop_prop(‘current_page’, $paged);  wc_set_loop_prop(‘is_paginated’, wc_string_to_bool(true));  wc_set_loop_prop(‘page_template’, get_page_template_slug());  wc_set_loop_prop(‘per_page’, $products_per_page);  wc_set_loop_prop(‘total’, $featured_products->total);  wc_set_loop_prop(‘total_pages’, $featured_products->max_num_pages);
  if($featured_products) {    do_action(‘woocommerce_before_shop_loop’);    woocommerce_product_loop_start();      foreach($featured_products->products as $featured_product) {        $post_object = get_post($featured_product);        setup_postdata($GLOBALS[‘post’] =& $post_object);        wc_get_template_part(‘content’, ‘product’);      }      wp_reset_postdata();    woocommerce_product_loop_end();    do_action(‘woocommerce_after_shop_loop’);  } else {    do_action(‘woocommerce_no_products_found’);  }


To wrap up the discussion, a product loop is an exquisite way to not only enhance website performance but also the CTR.

That’s why you must add this feature to your website or web page.

And if you are facing any difficulty to achieve, do write in the comment section. We would love to be there.

Till Next!

Social Media


Leave a Reply

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