Skip to content

Documentation

Extensive Documentation for PowerPack & WooPack to help you with common questions and issues.

  1. Home
  2. Docs
  3. WooPack
  4. Modules
  5. Product Grid
  6. How to change the number of Products being displayed using the Main Query on Archive pages?

How to change the number of Products being displayed using the Main Query on Archive pages?

In order to change the number of products that are being displayed using the Main Query, we need to use a bit of Custom Code.

“Main Query” uses the default WP_Query so, the number of products to be displayed is controlled by WooCommerce.

WooCommerce by default shows only 16 products via Main Query, so you will need to use a bit of custom code to allow a specific number of products while selecting the source as “Main Query”.

Please add the following code in the theme’s functions.php file:

// Change the Number of WooCommerce Products Displayed Per Page
add_filter( 'loop_shop_per_page', create_function( '$products', 'return 12;' ), 30 ); //Change 12 to number of products that you want to display

You can change the number of products to show by changing “12” to the number of products you want to display.

Was this article helpful to you? Yes No

How can we help?

×