How to change no. of products displayed in shop page programatically in OceanWP
-
Hi,
By default the no. of products displayed in Shop page is 12. I would like to change the no. to 40 by using some hook. I tried the following code, but its not working with OceanWP theme :
add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 );
function new_loop_shop_per_page( $cols ) {
// Return the number of products you wanna show per page.
error_log("avk : no. of products in shop page :- " . $cols) ;
$cols = 40;
return $cols;
}When I try the same code with Storefront theme, it works perfectly fine. Looks like it is an issue with OceanWP theme. Do I need to use a different hook to achieve that when using OceanWP theme ?
Thanks !!!
- The topic ‘How to change no. of products displayed in shop page programatically in OceanWP’ is closed to new replies.