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 );