How to change number of products on page for specific category in WooCommerce

Few days ago one of my clients needed to put all the products from specific category to one page in WooCommerce.

If you’re looking for tutorial how to remove pagination in a specific WooCommerce product category I’ll show you how to do it in just a few moments, without any third party plugins.

How to remove pagination or change number of products per page in WooCommerce for one category

Here’s an example: you need to put all products from category Shoes to a single page in WooCommerce, or change it’s products per page to 3. Then first thing you need to do it to find out product category ID.

Where to find WooCommerce category ID

To do it open WordPress admin panel and go to Products >> Categories. Find the cateogy you need and click on it’s title to open it in WordPress editor.

Now look at the page URL. You’ll see something like that https://yoursite.com/wp-admin/term.php?taxonomy=product_cat&tag_ID=36&post_type=product…

woocommerce where to find category id

Noticed the tag_ID? That’s your WooCommerce category ID.

How to change change products per page for specific WooCommerce category

Now when we have category ID we can change products per page or remove pagination for that category completely.

Go to Appearance >> Theme File Editor (or Tools >> Theme File Editor), and open functions.php file on the right.

Once you’re there scroll to the bottom of that file and add this code:

function shop_product_per_page($products) {
	if (is_product_category(36)) { // if category ID is 36
		$products = 100; // how much products to show on specific woocommerce category
	} else {
		$products = 6; // how much products to show on all other categories
	}
 return $products;
}
add_filter('loop_shop_per_page', 'shop_product_per_page', 30);

So if you want to change products per page in specific category to a different number, just change it in the code.

If you want to ger rid of pagination on specific WooCommerce category at all, just use a large number in there. For example – change 100 in the example to 100000. This way all the products will show up in a single category page.

Here’s the screenshot of live code:

woocommerce change how much products to show on page

That’s it – don’t forget to save changes by clicking Update File button.

Looking for more WooCommerce tutorials? Click here