Limit the number of products displayed in woocommerce product category pages

Viewed 1478

I am using the sober theme and I want to limit number of products to be show on the category page of each category.

Currently it is showing more than 10 products on a single page, what if I want to limit this to 10? I was able to limit number of related products on products description page.

How do I limit number of products on the category page?

1 Answers

To set the number of items per page for woocommerce product category archives pages, you will use:

add_filter( 'loop_shop_per_page', 'items_per_page_in_product_category_archives', 900 );
function items_per_page_in_product_category_archives( $limit ) {
    if( is_product_category() )
        $limit = 10;

    return $limit;
}

Code goes in function.php file of your active child theme (or active theme). Tested and works.

Related