This tutorial will show you how to change available values of the “number of products per page” option in WooCommerce templates.WooCommerce. How to change “number of products per page” option available values
The number of products that show up on the default Shop page and Products Category pages can be changed within WordPress Admin Panel in Cherry Options -> Shop Settings -> Products per page.
However, this option is limited to 20 products:
Let’s find out how to increase this limit.
Log into WordPress Admin Panel, go to Appearance -> Editor tab, open options.php file under themeXXXXX (where XXXXX is the number of your theme) to edit:
Note: You can also edit options.php file via FTP. The path to locate the file is wp-content/themes/themeXXXXX.
In this file, you will find the following lines of code:
$per_page_options = array( '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9, '10' => 10, '11' => 11, '12' => 12, '13' => 13, '14' => 14, '15' => 15, '16' => 16, '17' => 17, '18' => 18, '19' => 19, '20' => 20);
You just need to duplicate the line to continue the code string. For example, add:
, '21' => 21, '22' => 22, '23' => 23, '24' => 24
to get 24 products as the limit.
You can find the example of the lines of code for increased limit of products below:
Go back to Cherry Options -> Shop Settings -> Products per page to see that the limit has been increased:
Refresh the default Shop page or the Products Category Pages to check the result.
Feel free to check the detailed video tutorial below:WooCommerce. How to change “number of products per page” option available values