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
LoicTheAztec
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:
来源:https://stackoverflow.com/questions/38928657/changing-the-number-of-columns-in-archive-pages-in-woocommerce