How to Change the number of shop columns in Woocommerce

Welcome friends, today I will show you how to change the number of shop columns/change number of products per row in Woocommerce. By default, WooCommerce show products in 3 columns and a sidebar. This is the basic style to display products in listing page. The columns are sized according to our theme’s design or the maximum width of the browser window. But if we want our custom columns number then we need to write code. WooCoomerce comes with huge hooks and those hooks are very useful to change WooCommerce default functionality. Using a WooCommerce hook(loop_shop_columns) we can do that.

Change number of products per row in Woocommerce for Custom Theme

To change the number of products per row, use this code in your theme’s functions.php file.



// Change number or products per row to 4
add_filter('loop_shop_columns', 'my_loop_columns');
	function my_loop_columns() {
		return 4; // 4 products per row
	}

Change number of products per row in Woocommerce for WooTheme

To change the number of products per row, use this code in your WooTheme’s functions.php file.

// Override theme default specification for product # per row
function my_loop_columns() {
return 4; // 4 products per row
}
add_filter('loop_shop_columns', 'my_loop_columns', 999);

I hope now you can Change the number of shop columns according to your theme requirements. Please comment for any help

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •