Understanding WooCommerce Template Overrides

One of the most common issues I see with WooCommerce sites are template overrides. In this article I want to first establish what a template override is, how it gets on your site, and how to either address or fix the issue.

What is a Template Override?

A template override simply means that a certain page, feature, or layout of your WooCommerce installation is being controlled by your theme instead of your plugin. As I’ve said before (and will certainly say again), themes are only meant to control the design of your site, and plugins should control functionality.

How do we figure out if your site has an active Template Override? Easy! What we need to do is open up your WordPress Dashboard, then go to WooCommerce > System Status. On that page, you can scroll down to the section called “Templates”. If you have a template override, then it will appear here.

For an example, here is a screenshot from a System Status Report where all of the WooCommerce templates are overwritten – unfortunately, a common situation.

Click to see full version.

Click to see full version.

Understanding the List

That’s a lot of files, so how do we know which is causing the problem? That’s a little harder. You’ll need to understand the WooCommerce template structure, but typically reading the file path will give you a good idea: for example, we can assume that bad-theme/woocommerce/single-product/title.php controls the title of a Single Product page. When in doubt, you can check the reference page on WooCommerce.com for some more detailed insight.

What are Template Overrides used for?

Template overrides are useful for theme developers because they can modify the appearance of a WooCommerce page properly – instead of changing the actual plugin files which will be overridden during an update, it’s included in the theme that they can control. Although it’s not the best way (a function would be the best way), it’s much better than modifying a plugin, which you should never do.

How did it get on my WordPress installation?

Through your theme. If you open your theme in an FTP browser, then you’ll see a woocommerce folder there – that’s where those overrides live. It could also be done in a child theme, but more often than not when it breaks it’s due to a lazy developer who lumped in files instead of making proper alterations via hooks.

Why are Template Overrides bad?

A template override in and of itself isn’t a bad thing, and it may not actually have a negative impact on your site. However, template overrides can stop WooCommerce from running properly.

An example of this could be if the template override was created while the latest update to WooCommerce was 2.0.11. Since we’re now in the 2.4.x era (as of writing), that template is severely out of date. If that overridden file is referencing a function that no longer exists, or if another file was looking for an updated function in that file, there’s a disconnect, and your site will fail – either it won’t work correctly, or it will shut down entirely.

How do I fix problematic Overrides?

This is a harder question. The first answer is to go to your theme author – they may be able to provide an update that will fix any issues or remove an override. However, if that’s not an option or you’re on your own, then there’s only a few options:

  1. Hire a developer to fix your site.
  2. Learn how to code PHP and hunt down the error.
  3. Switch to a different theme (if you’re running WooCommerce, HANDS DOWN your best place to shop is at the source, http://www.woothemes.com/product-category/themes/).
  4. Remove the template overrides entirely.

Since we can’t cover the first three, let’s talk about how to remove template overrides.

Removing Template Overrides

This is usually the best solution in my opinion, but developers will argue all day I’m sure. It’s easy to fix with this route, but it’s a good idea to make a backup of your theme before doing so in case something doesn’t go well… That goes for any change, by the way. Save early, save often, and use something like BackWPup.

To remove the overrides, follow these steps:

  1. Open your site in an FTP editor, and navigate to your theme (something like wp-content/themes/YOURTHEME/).
  2. There, you’ll see a woocommerce folder. Note that this is NOT the one in your plugins directory – it will reside directly in yoru theme.
  3. Rename the woocommerce folder to something like woocommerce-overrides. We’re renaming so we can easily revert if we have to.
  4. Upon reloading your site, you should be override free. You can check by again going to your System Status Report, where no overrides should be present.

At this point, your site is free of overrides! Hooray! That should work to fix the problem, but if not then the issue is outside of overrides. In that case, you’ll need to search a little more for a solution (or use the guide I wrote here). Hopefully this helps and saves you some time and trouble! 🙂


Have any questions or comments about this article, or ways you think it can be improved?
Join the conversation in the comments below, or sign up for my newsletter to recieve periodic updates!

Tags: , , , , ,

2 Responses to “Understanding WooCommerce Template Overrides”

  1. Vince Miller April 13, 2017 at 11:03 EDT (11:03 AM) #

    In #4 above you say “reload your site.” How do I do this action?

    • Danny Santoro April 13, 2017 at 14:22 EDT (2:22 PM) #

      Just refreshing the page would work – if you have a caching plugin enabled then clearing the cache before refreshing would help for all users.

Leave a Reply

%d bloggers like this: