Changing the number of columns in Storefront for WooCommerce

How to change the number of columns in the Storefront Theme versions from and above 2.1.8 for WooCommerce

From version 2.1.8 there seemed to be a code change to the way the number of columns worked in the storefront theme for WooCommerce, here is the newer code to insert into the bottom of your “functions.php” within the Woocommerce Storefront theme through the editor.

// Change number or products per row to 5
add_filter(‘storefront_loop_columns’, ‘loop_columns’);
if (!function_exists(‘loop_columns’)) {
function loop_columns() {
return 5; // 5 products per row
}
}

All being well this should work in storefront theme versions, 2.2.0 / 2.2.1 / 2.2.2 / 2.2.3 / 2.2.4

Simply change the three numbers (5) above to how many columns you wish to change the default too.

Let me know in the comments below  if it worked for you…