Editing WooCommerce default product column count

May 13, 2012 | Ecommerce, PHP, Plugins, Time Savers, Troubleshooting, Tutorials, WooCommerce, Wordpress | 39 comments

You know it’s the little things in life that highlight our great successes. I have been looking for this for literally hours.. What I wanted to do was edit the number of product columns that are shown in the default grid view homepage. It’s set to 4 and I wanted 3. Not hard right? Sadly it was but the solution was a two liner! Let me explain…

Woocommerce, by default, doesn’t work from a shortcode (it can do but not by default), instead it will show the shop page content using it’s own template system. It will look for arguments/parameters attached to the shortcode in order to augment the number of columns on any product listing page. I know I know, I just said that we aren’t using a shortcode but it’s looking for one anyway? Almost.. here is the solution:

global $woocommerce_loop;
$woocommerce_loop['columns'] = 3;

There we have it, two lines. Either a sign of my genius or incompetence. I suspect the latter but for the moment I am fairly proud of this achievement. Essentially $woocommerce_loop contains the settings for the product page and by default the columns argument isn’t set leaving it up to the shortcode to populate (if used) or to fall back to it’s standard setting.. 4!

So after hours of trawling through code trying to find a WordPress Filter I can hook onto, I thought I would try this little gem (added to my theme functions.php) and magically it worked. This post can now hopefully help the next person to have to deal with this or indeed for someone to point out my stupidity and show me how it should have been done.

A Donate Button!


  1. yesh

    Thanks ..! You saved me and my headache! Trying to find an answer from long time! Thank you so much


Submit a Comment

Your email address will not be published. Required fields are marked *

CommentLuv badge

Stay in touch!

Page Builder Cloud

Page Builder Cloud

A truly universal template library for WordPress Page Builders.

Page Builder Recommendation

Elementor Banner

We are BIG fans of the Elementor page builder. Give it a look!

About this site and Sean Barton

Picture of Sean
Sean Barton is a Freelance PHP Website Developer in Crewe, Cheshire. He is a Wordpress and CMS/Framework specialist and Co-Founder of Page Builder Cloud.
This site was set up in 2008 as a tutorial and scripting resource for the PHP language and Wordpress.
Find out more about Sean on the About Me page or use the Hire Me page to get in touch. For more information about Sean's work take a look at the Portfolio

Our Services

  • Wordpress plugin/theme development
  • Divi specialist
  • Ecommerce (Woocommerce, WPSC, Shopify, Magento)
  • PSD to Wordpress theme conversion (Responsive)
  • Website design work (Banners, Logos, Full Site, etc)
  • Website analysis (security, usability, SEO)
  • API Integrations (InfusionSoft, SalesForce, Ontraport, Customer Thermometer, etc..)
  • Wordpress consultancy & expert advice
  • Crisis support
  • Website hosting

The main services offered are Wordpress based although we do a great deal of technical programming for bespoke systems. From troubleshooting, extending frameworks, finding bugs to writing them from scratch.

Find out more by looking through our past projects or get a quote.

Be the first to hear about new products/updates!

This is a mailing list for those people interested in being told when we release a new product (Divi plugin or Theme).

We shall also use this list to let you know about product updates and releases.

You have Successfully Subscribed!