WooCommerce: Disable Theme’s WooCommerce Template Overrides

A client purchased a premium “WooCommerce-ready” WordPress theme on Themeforest. Unfortunately, this theme comes with a /woocommerce folder, which means theme developers completely override WooCommerce template files by copying them to the folder, and customizing each of them by hand to match their design and functionality needs.

As you know from my “How To Become an Advanced WooCommerce Developer?” article, however, themes should NOT come with a /woocommerce folder – instead they should use “hooks” (actions and filters) to amend default WooCommerce plugin layouts and behavior. This is a huge problem for best seller themes and their legacy coding – and also a reason most themes break when you update WooCommerce…

So the question I asked myself was: how can I disable the entire /woocommerce folder (i.e. ALL WooCommerce template overrides) in a given theme, so that I can use the default WooCommerce ones instead?

Fix 1 (not ideal): Disable Theme’s /woocommerce Folder

The easiest thing to do is going to your theme’s folder inside wp-content and RENAME the /woocommerce folder to something else e.g. /DISABLED-woocommerce (see screenshot above)

Super easy – but next time you update the theme, you’d need to re-do this. And trust me, you’ll probably forget about it and your WooCommerce site will use those overrides once again…

Fix 2 (ideal): Add a Single Line to wp-config.php File

This is a little gem (thanks to Damien Carbery who came to my rescue). If you study WooCommerce plugin files, and specifically the wc_get_template_part() function, you will see a note:

WC_TEMPLATE_DEBUG_MODE will prevent overrides in themes from taking priority

So, thanks to Damien, I added the following line to wp-config.php:

* @snippet Do not load theme /woocommerce folder - WooCommerce
* @how-to Get CustomizeWoo.com FREE
* @sourcecode https://businessbloomer.com/?p=80903
* @author Rodolfo Melogli
* @compatible WooCommerce 3.4.7

// Add this to wp-config.php file

define( 'WC_TEMPLATE_DEBUG_MODE', true );


Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

12 thoughts on “WooCommerce: Disable Theme’s WooCommerce Template Overrides

  1. Hi Rodolfo,

    I’m having issues with the shipping fees calculator not showing in the cart/checkout pages, i tried your solution but then I couldn’t load the cart page. Can you please let me know where exactly to add the line “define( ‘WC_TEMPLATE_DEBUG_MODE’, true );” in the file wp_config.php?
    Thanks a lot for your help

    1. If that doesn’t work for you, simply switch to Storefront theme temporarily and see if the error goes away, in which case it’s your theme’s fault

    1. Welcome

  2. You have just saved my life. As a total noob, I have just spent a week looking for ways to do this, and you solved it in one fell swoop. I think I might love you <3
    Thank you!!

    1. Thank you!

  3. Rodolfo, if you do not need that Woocommerce folder why do not just delete it?

    1. Because at the next update it will come back – hence why I use the snippet (will work all the time)

  4. Hey Rodolfo,
    What’s the point of preventing overrides in themes from taking priority altogether ?
    You always need to override emails at least.
    When I develop a theme, the Woocommerce folder is a must I think.
    Also, if you disable it in commercial theme you bought you harm the theme function.
    Could you refer to these issues?

    1. These are very good questions Yehuda, thanks!

      You always need to override emails at least” – not entirely true. WooCommerce email hooks are usually sufficient, also Woo are launching a new email template editor very soon.

      When I develop a theme, the WooCommerce folder is a must I think” – definitely not, I don’t like themes that do that (hence this tutorial). Actions and filters can make you achieve 99% of the customization you usually require. Storefront theme has no /woocommerce folder for example.

      Also, if you disable it in commercial theme you bought you harm the theme function” – yep, definitely possible, depending on how the theme is coded. Mostly if they also have woocommerce.php file override and other weird things. In general, themes should use WooCommerce hooks and not any other way for overriding WooCommerce.

      Hope this makes sense 🙂

  5. Hello, Rodolfo,

    I added the code but the notifications are not gone https://prntscr.com/l9vuwx

    1. Hey Christian, thanks for your comment 🙂 I don’t think this function also removed those override notifications – but for sure it does avoid those overrides are loaded. Just tried on a client’s website, works very well!

Questions? Feedback? Support? Leave your Comment Now!

If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)

Your email address will not be published.