Sandesh

May 3, 2020

WooCommerce: Change Number of Products Per Page @ Shop

If you don’t have much product and you want to display all products, then this snippet will work for you. This snippet will change the number of products shown per page on the shop page.

If you have 20 or fewer products, then you don’t need to display pagination instead of display all products on the shop page. You just need to change the count of products, and you are ready.

Code: Change the number of products displayed per page @ shop page

/**
 * @snippet       WooCommerce: Change the number of products displayed per page @ shop page
 * @author        Sandesh Jangam
 * @donate $7     https://www.paypal.me/SandeshJangam/7
 */
 
add_filter( 'loop_shop_per_page', 'ts_restrict_product_count_shop_per_page', 99 );
 
function ts_restrict_product_count_shop_per_page( $products_count ) {

	// Set your expected product count here.
	$products_count = 12;
	
	// Return the product count.
	return $products_count;
}

Where to add custom PHP code?

Add the above PHP code at the end of to your child theme’s functions.php. There are many ways to add custom PHP code ( custom functionality ) to WordPress / WooCommerce website. Read this article for more information

Why this code is not working?

If you face any issue with the above code, then please let me know in the comment. I will be happy to review the code, and If it is working for you, then show me some love in the comment section.

Thank you in advance…!

Sharing is Caring!
Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on telegram
Share on whatsapp

About the Author

Sandesh Jangam is Developer, WooCommerce Expert, and Podcaster. He is working as a WordPress developer since 2014 and helping people with this blog. He loves to travel ancient temples, chilling at the beach and reading books

Join 1,000+ Subscribers

Get exclusive access to WordPress, WooCommerce tips, articles, tutorials right in your inbox.​

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on telegram
Share on whatsapp

Leave a Comment

Your email address will not be published.

Become a WooCommerce Customization Expert and Earn More​

Get an early access notification right in your inbox.

Learn More or Register Now >>>