Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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


1 Answers

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:

  • Change number of products per row
  • WooCommerce conditionals tags
  • WooCommerce - Changing the number of product categories per row
like image 104
LoicTheAztec Avatar answered Oct 23 '25 04:10

LoicTheAztec



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!