Josh Mountain

web dev & nerdy things

Changing Woocommerce Products Per Page

4 years ago
#WordPress 

There are two viable methods for limiting how many products are displayed on each WooCommerce page, I will give a brief overview of both solutions and you can pick which would suit your project better.

The Easy Solution

The easiest way to set how many WooCommerce products are displayed on each page is through the WordPress admin panel. In the Settings menu select Reading from the dropdown.

Now that you are in the Reading Settings page, set the value of Blog pages show at most to your desired products per page count. I changed the value to 12 in this example which would display 12 products on each of my WooCommerce pages.

The Slightly More Complicated Solution

For whatever reason if you aren’t satisfied with the above solution, or if you would prefer to use a a hook you can add the following to your theme’s functions.php file.

// Display 12 Woocommerce products per page.
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 12;' ), 20 );

···

Did this post help you?

All the content on my site is provided ad-free and generates no revenue. If you would like to compensate me for the time I spend writing these posts, please consider a Bitcoin donation: 1LVRzmuw1jZyLaW4gN1QZPjKzSvxVmPAXi

comments powered by Disqus


© 2017 Josh Mountain.
Powered by Canvas & Laravel. Served up with DigitalOcean.