WooCommerce PHP Beginner Requires WooCommerce

Change How Many Products Show Per Page

Set how many products appear on each shop and category page in classic themes.

Tested on WordPress 7.1 PHP 8.3 Updated
functions.php 3 lines
add_filter( 'loop_shop_per_page', function (): int {
	return 24; // Pick a number that divides evenly by your column count.
}, 20 );

Where to add this

Recommended A code snippets plugin Survives theme changes and is easy to switch off.
Child theme At the end of your child theme's functions.php file.
Must-use plugin As a .php file in wp-content/mu-plugins, starting with <?php.

Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.

Classic themes show a set number of products per shop page, often 12 or 16. This snippet sets your own number.

How it works

The loop_shop_per_page filter sets the number of products in the main shop query on the shop, category, tag and product search pages. It runs at priority 20, after most themes set their own default.

Things to watch

  • Choose a multiple of your column count, so the last row isn’t half empty. With 4 columns, 12, 16, 24 or 32 work well.
  • More products per page means heavier pages. 24 to 36 is a good balance.
  • Block themes set the number in the Product Collection block’s settings instead.

How to test it

Open the shop and count the products on the first page, or look at “Showing 1–24 of N results”.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only