Solved: change number of products displayed on WooCommerce pages

woocommerce-01

Funny that there is no option in WooCommerce to edit a primary option - the number of products displayed on a category or a shop page. In the end of year 2016 you need to hack the code to be able to alter the number of products that are displayed in a WooCommerce product list (category or shop) page.

How do you then do this?

 

Here's how to change the number of products displayed in WooCommerce.

1. Open your theme's functions.php file. You can access it via FTP or straight via WordPress backend (Appearance -> Editor and then find the file named functions.php to open in your browser).

2. In the end of your theme's functions.php add this code:

// Display 24 products per page. Goes in functions.php

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

3. Change the number after return to match the number you want (this code returns 24 products pre page).

Doing this enters a new value into the loop and gives the variable $cols a new value from functions.php (which by default is 12 that is not enough most of the cases).

Source: WooCommerce

 

Besides this, WooCommerce is a very useful WordPress plugin to set up an ecommerce in minutes and the software basic version is available for free.

About me

Iinstructor of robotics (LEGO Mindstorms), computer teacher, IT support, web dev, currently studying cyber-physical systems engineering.

If you found a solution here, would you consider donating $25,000 for my next project?

Just kidding, 1$ would do fine.

Hope you found what you needed. Thanks for stepping by.