If your WordPress theme supports WooCommerce, then you might already have a setting that lets you set the number of products per page in your WooCommerce shop.
So, before jumping to the solution part, check your theme’s options for something like this:
This is how it looks on the Avada theme (affiliate link).
You can usually find your theme’s settings in Appearance > Theme Options or in Appearance > Customize if the developers integrated them there.
In case your WordPress theme doesn’t support WooCommerce, then I’ll show how to add a simple code that gets the job done.
Yes, if it’s possible and easy, we’ll be using a code, not a plugin :D . The fewer plugins you have, the better!
Change the number of products per page in WooCommerce
Before beginning, I recommend backing up the functions.php
file or the entire website, as well as having a child theme in place, otherwise, the changes you make will disappear with the next theme update!
If you don’t have a child theme and it would be too complicated for you to set up one now, then you should use the Code Snippets plugin and add the code there.
Now, let’s get to it!
Step 1 – Access the functions.php file
Access your WordPress website’s files and edit the child theme’s functions.php
file.

Editing functions.php via cPanel
It should normally be in /public_html/wp-content/themes/YourThemeName-child/functions.php
.
If you’re using an add-on domain, not your main one, then it should be in /public_html/YourDomain/wp-content/themes/YourThemeName-child/functions.php
.
Step 2 – Add the filter
Add the following PHP code (provided by the Woo devs) at the very bottom of the file or right before the ?>
closing tag (if it exists).
Don’t forget to update/save the file!
This filter will display 9 products per page.
To modify that number, simply change the value in $cols = 9;
.
For example, if you want to display 12 products per page, then add 12 instead of 9: $cols = 12;
.
That’s a wrap
I hope you found the post useful and managed to change the number of products displayed per page in your WooCommerce shop!
Don’t forget to share the post to help out others!
You can quickly subscribe to my newsletter by using this link.
If you have any questions or thoughts, drop a comment or send a message via contact or Facebook page.
You can also hit the follow button on Twitter and subscribe to the YouTube channel.
My WordPress installation service is at your disposal!
On-going WordPress support and maintenance services are on the menu as well!
Extra, it works. I have used that method on every online shop
Awesome! I’m glad it helped!
It’s working. Excellent….
Awesome! :D
it didnt work for my theme could you help
Try clearing your site and browser cache after adding the code.
Doesn’t work for me! Still shows 12 products….
/**
* Change number of products that are displayed per page (shop page)
*/
add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 24 );
function new_loop_shop_per_page( $cols ) {
// $cols contains the current number of products per page based on the value stored on Options -> Reading
// Return the number of products you wanna show per page.
$cols = 24;
return $cols;
}
Because you’ve also changed the number 20 with 24 here
add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 24 );
. That has nothing to do with the columns, so it needs to be set to 20. Only change the number in$cols=
. Also, clear your site and browser cache.So, what does the number of 20 mean in this code line please?
add_filter( ‘loop_shop_per_page’, ‘new_loop_shop_per_page’, 20 );
hi , thank you , but is there anyway to change products per category page , because in my shop page products per page is 32 but when i filter a category it’s only showing 9 products per page :) help thank you
I tried it now on my testing site with the latest WooCommerce version. I set it to 3 products per page, and I got 3 products in the shop page, the category page, and in the sorting results page. So, the code definitely works. The problem must be somewhere else.
Hello,
I added the code too my webshop, but there still shows up 9 product per page. I also cleared the cache and my browser cache.
You save me!
All evening looking for some PHP code to set this and nothing works.
My DIVI theme has this option and I didn’t see it before reading your post…