How to declare WooCommerce support in your theme

How to declare WooCommerce support in your theme featured image

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.

From WooCommerce Github docs:

If you are using custom WooCommerce template overrides in your theme you need to declare WooCommerce support using the add_theme_support function. 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.

Source, here.

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

  1. Open your theme (or child theme) functions.php file
  2. Edit it to add add_theme_support( 'woocommerce' );
  3. Save your functions.php file

Done!

Leave a comment below if this worked / didn’t work for you.

1 thought on “How to declare WooCommerce support in your theme

Leave a Reply

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

Silicon Dales