Some shops just do not have many products, or want to list all the products availble on a single page. Out of the box WooCommerce will paginate your products. Maybe you want to list all your products on one page though?
The easiest way to do this is with a one line filter, the documentation even explains this. However at first glance you would think you need to put some large number in to make sure you never hit that per page limit. If you are familiar with the WP_Query pagination parameters though, you will know that
-1 will return ALL results without pagination.
Combine that knowledge with the filter in the WooCommerce documentation and you have a proper filter to display all your products at once!
Just add this line to your theme’s
functions.php file for it to start working.
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return -1;' ), 20 );
Subscribe to Patrick Garman
Get the latest posts delivered right to your inbox