Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Theming Snippets] Change number of products displayed per page
/**
* Change number of products that are displayed per page (shop page)
*/
add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 );
function new_loop_shop_per_page( $cols ) {
// $cols contains the current number of products per page based on the value stored on Options -> Reading
// Return the number of products you wanna show per page.
$cols = 9;
return $cols;
}
@mmh4560

This comment has been minimized.

Copy link

@mmh4560 mmh4560 commented Jan 22, 2019

If I use $cols = 12; instead of $cols = 9;.
Why It's not working in my WordPress Divi theme ??

@sreygel

This comment has been minimized.

Copy link

@sreygel sreygel commented Feb 15, 2019

I have the same problem... :(

@cesarguillenf

This comment has been minimized.

Copy link

@cesarguillenf cesarguillenf commented Feb 19, 2019

same problem

@JasonS1995

This comment has been minimized.

Copy link

@JasonS1995 JasonS1995 commented Mar 1, 2019

Guys, in Divi, this snippet doesn't work, however you can easily change the number of products in the Divi Theme options on the General Tab.

@domaingood

This comment has been minimized.

Copy link

@domaingood domaingood commented Oct 15, 2019

@cesarguillenf
Try Divi Theme Options =>
Number of Products displayed on WooCommerce archive pages

@betharte7

This comment has been minimized.

Copy link

@betharte7 betharte7 commented Jan 6, 2020

Thank you very much. I've changed the product number per page in the Divi Theme Options and it works fine.

@AT4MO

This comment has been minimized.

Copy link

@AT4MO AT4MO commented Aug 3, 2020

hello, how i can use that for display product at mobile? 4 mobile 5 desktop ?¿

ty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment