WooCommerce: Change Number of Products Per Page

If you have many products and don’t want to use pagination (splitting the page in 1, 2, 3 or more pages), here’s the fix for you.

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

PHP Snippet: Change “Products per Page” @ Shop and Loop Pages

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

Some themes may affect this default figure:

  • by using a snippet similar to the one below
  • or by following the settings defined at WordPress Dashboard > Reading > “Blog pages show at most”.

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

/**
 * @snippet       Products per Page - WooCommerce Shop
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.6.2
 * @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 this snippet?

You can place PHP snippets at the bottom of your child theme functions.php file (delete "?>" if you have it there). CSS, on the other hand, goes in your child theme 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 free video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything worked 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 on PHP 7.3.

If you think this code saved you time & money, feel free to join 14,000+ WooCommerce Weekly subscribers for blog post updates or 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 *