Received a WooCommerce help SOS through our contact form, so here is the simple answer to a question we’ve been asked more than once!
Declaring WooCommerce theme support is really important after WooCommerce 3.3.0 – if your theme does not contain this in functions.php, then there’s a good chance any woocommerce templates you add to /wp-content/[your-theme]/woocommerce/ will not be loaded. This means you’ll lose all your customizations immediately on upgrade.
This is one of the first things to check if you recently updated WooCommerce and find you have lost your WooCommerce themes… is the necessary line (below) actually in your functions.php file in your theme, or child theme? No? Well add it!
[HINT if you came here looking for actual WooCommerce Support <- visit the link! i.e. if you wanted help and support with your wc project]
If you have WordPress + WooCommerce installed, and your theme doesn’t explicitly say it “supports WooCommerce” you’ll get a nag screen at the top that says something along the lines of “your theme doesn’t declare woocommerce support … “. In more recent versions, this has had a real impact, as it also means your WooCommerce templates (overrides you make to WooCommerce template files, held in your theme’s files) will potentially be ignored. This, if you have styled your store, you do not want.
If you are using custom WooCommerce template overrides in your theme you need to declare WooCommerce support using the
add_theme_supportfunction. WooCommerce template overrides are only enabled on themes that declare WooCommerce support. If you do not declare WooCommerce support in your theme, WooCommerce will assume the theme is not designed for WooCommerce compatibility and will use shortcode-based unsupported theme rendering to display the shop.
This is Important
Basically, if your theme has any form of WooCommerce specific customization at all, you will want to declare WooCommerce support in your WordPress theme.
This is very important, in other words. Without this line, your customizations will break.
How to declare WooCommerce support in your theme
- Open your theme (or child theme) functions.php file
- Edit it to add
add_theme_support( 'woocommerce' );
- Save your functions.php file
Leave a comment below if this worked / didn’t work for you.