user4925536
user4925536

Reputation:

Changing the number of columns in archive pages in woocommerce

How can I change the number of columns in archive pages in woocommerce?

It shows 3 in shop pages, but 4 in archive pages.

Thanks

Upvotes: 3

Views: 2554

Answers (1)

LoicTheAztec
LoicTheAztec

Reputation: 253804

This snippet code will change the number of products per page on all archives pages:

add_filter('loop_shop_columns', 'loop_columns');
if (!function_exists('loop_columns')) {
    function loop_columns() {
        return 3;
    }
}

This code goes on function.php file of your active child theme or theme

Advice: Sometimes, is necessary to change some css rules, to get the correct display per row.

If you want to target some specific archive pages you can use WooCommerce conditionals tags in an if/else statement as in this thread


References:

Upvotes: 2

Related Questions