Change the number of products on the page in WooCommerce

Sometimes for any category of WooCommerce products, or for a custom taxonomy, you need to specify the number of products on a page that is different from the default.

You can change the number of products in a row using the loop_shop_columns filter:

add_filter( 'loop_shop_columns', function($columns){
    if(is_tax('product_brand')){
        return 30;
    }else{
        return $columns;
    }

} );

Or change the number of products on the whole page:

add_filter('loop_shop_per_page', 'set_loop_shop_per_page');

function set_loop_shop_per_page($per_page)
{
    if (is_tax('product_brand')) {
        return 30;
    } else {
        return $per_page;
    }
}

Updated: 11.01.2019

Did this article help you? Rate it!
(No Ratings Yet)
Loading...


Leave a Reply

Your email address will not be published. Required fields are marked *