I have the following category within a site:
http://rivetnuttool.com/site/product-category/blue-pneumatic-rivet-nut-tools/
And I want it to show all of the 7 products within the first page, and even if I have 100 products to show them in one single page.
I have tried with different solutions like adding this to my functions.php file:
add_filter( ‘loop_shop_per_page’, create_function( ‘$cols’, ‘return -1;’ ) );
Rewriting the shortcode like the solution proposed here http://ideas.woothemes.com/forums/133476-woocommerce/suggestions/4146798-add-pagination-support-for-list-of-products-render
And several other online options, and none of them seems to work, I allways get the pagination and the limit.
The theme used in the site is Divi.
4
Answers
I corrected and changed the custom code from the above blog post to:
And everything works now.
loop_shop_per_page
is the correct filter. If you aren’t seeing any effect, then add a later priority. In my test case my parent theme was filteringloop_shop_per_page
so my child theme’s filter wasn’t doing anything.To apply the filter to only product categories you would add some conditional logic:
Just add the conditional check to your functions.php file:
Now, in 2019, I just adjust a parameter in a Customize panel by:
Apperance>Customize>WooCommerce Options>Shop Archive sidebar layout>total products per page
Then, fill the number I want into that.