WooCommerce Change Number of Columns

This article describes how to change the number of columns displayed within a WooCommerce shop.

  1. Log into WP-Dashboard
  2. Access the themes functions.php file by clicking Appearance > Editor > functions.php
  3. Add the following line of code to the top of functions.php
  4. Save the file and you’re all set
add_filter('loop_shop_columns', 'loop_columns');
if (!function_exists('loop_columns')) {
	function loop_columns() {
		return 3;
	}
}

The above code will change the layout to 3 columns instead of the default 4 columns. Simply change the number “3” to the desired number of columns.

Important

Changes made to any PHP file within a Theme will be lost when that theme is upgraded. We recommend using a Child Theme for all PHP updates. Child Themes Explained →