WooCommerce: Change Number of Products Per Page

If you’re not happy with the default number of products per page (16), or if your theme overrides the default WooCommerce setting for “per_page” products and you need to change it, here’s the fix for you.

Please note that you may also need to set the number of WooCommerce product grid columns, so that you can make sure the total number of products per page is a multiple of that and you don’t leave the shop page with empty grid items.

Enjoy!

Edit the number of WooCommerce products per page (12 in this case)

PHP Snippet: Change “Products per Page” @ WooCommerce Shop

The default number of products per page is 4 rows * 4 columns = 16 products.

Some themes may affect this default setting by using a snippet similar to the one below – in such case try to increase the “9999” priority to a greater number.

In the snippet below, simply define the number of products per page by changing “12” to whatever number you like.

/**
 * @snippet       12 Products per Page - WooCommerce Shop
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 7
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_filter( 'loop_shop_per_page', 'bbloomer_redefine_products_per_page', 9999 );

function bbloomer_redefine_products_per_page( $per_page ) {
   $per_page = 12;
   return $per_page;
}

Where to add custom code?

You should place PHP snippets at the bottom of your child theme functions.php file and CSS at the bottom of its style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my guide "Should I Add Custom Code Via WP Editor, FTP or Code Snippets?" and my video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything went as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting.

If you think this code saved you time & money, feel free to join 17,000+ WooCommerce Weekly subscribers for blog post updates and 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance!

Need Help with WooCommerce?

Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

21 thoughts on “WooCommerce: Change Number of Products Per Page

  1. ah rodolfo, again, you saved my ass from my clients. hahaha.
    this code is work like charm.

    1. Nice!

  2. I think it only works if theme supporst Woocommerce:

    add_theme_support( 'woocommerce' );
    1. Which I hope it does in the first place!

  3. Code still works in 2020. Thanks for saving me some developer money.

    1. Great!

  4. excellent

    1. cool

    1. Thanks!

  5. Hello Rodolfo,
    I have Multisite, and this snippets does not work. By default Woocomerce shows 12 products, I increased it to 20, but it doesn’t work.
    PP Version: 7.3
    Wordpress version: .2.2
    Woocommerce version: 3.6.5

    1. Update: WordPress 5.2.2

      1. Hi Mario, thanks for your comment! I just tested this again with Storefront theme and it works perfectly. Maybe your theme (or another plugin) is messing/conflicting with my snippet?

        To troubleshoot, disable all plugins but WooCommerce and also switch temporarily to “Twentyseventeen” theme (load the snippet there in functions.php) – does it work? If yes, you have a problem with your current theme or one of the plugins.

        Hope this helps!

        R

  6. Works great! Thank you so much! I don’t know how many snippets I tried before coming across this page to change the amount of products for all pages.

    1. Thanks!

  7. I have tried above snippet and it is no longer working now.

    1. Hi Javed, I just tested this again with Storefront theme and it works perfectly. Maybe your theme (or another plugin) is messing/conflicting with my snippet?

      To troubleshoot, disable all plugins but WooCommerce and also switch temporarily to “Twentyseventeen” theme (load the snippet there in functions.php) – does it work? If yes, you have a problem with your current theme or one of the plugins.

      Hope this helps!

      R

  8. Hi Rodolfo!

    I’ve just upgraded my site’s php version to 7.2 and

    create_function()

    has been deprecated. Are you prepared to update this snippet to work with 7.2? Would love you even more if you do!! Thanks!

    1. Done ๐Ÿ™‚

  9. Hey there,

    You need to remove the strong html tag around 40 in the code example.

    Thanks!

    1. Ben, thank you SO MUCH for your valuable feedback – I just made that correction (I don’t know where the came from lol!). ~R

Questions? Feedback? Support? Leave your Comment Now!
_____

If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)

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