Website Building » WooCommerce » How Do I Change the Product Count in WooCommerce?

How Do I Change the Product Count in WooCommerce?

Last updated on January 19, 2023 @ 3:44 pm

If you’re running a WooCommerce store, you’ve probably noticed that the default product count is set to 12 products per page. While this is fine for most stores, there may be times when you need to change the product count.

For example, if you have a lot of products and want to increase the number of products per page, or if you have a few products and want to decrease the number of products per page.

Luckily, changing the product count in WooCommerce is relatively easy. In this article, we’ll show you how to change the product count in WooCommerce.

How to Change the Product Count in WooCommerce

To change the product count in WooCommerce, you need to add a snippet of code to your functions.php file. Don’t worry, this is easy to do.

Here’s what you need to do:

    1. Log into your WordPress site and go to your theme editor.
    (Your theme editor can be found at Appearance > Editor. )

    2. On the right hand side, you will see a list of files.
    Find and click on the functions.php file.

    3. Once you’re in the functions.php file, scroll down until you see the following line of code:

    function my_theme_setup() {  
            add_theme_support( 'woocommerce' );  
        }  
        add_action( 'after_setup_theme', 'my_theme_setup' ); 

    4. Add the following code snippet below that line:

    add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 12;' ), 20 ); 

    5. Save your changes.

PRO TIP: If you are thinking about changing the product count in WooCommerce, be aware that this could have an adverse effect on your website. It is best to leave this setting alone unless you are confident in your ability to make the change without breaking anything.

And that's it! You've successfully changed the product count in WooCommerce.

Conclusion:

Changing the product count in WooCommerce is easy to do and only requires a few lines of code. By default, WooCommerce displays 12 products per page, but you can change this by adding a snippet of code to your functions.

Madison Geldart

Madison Geldart

Cloud infrastructure engineer and tech mess solver.