Using WooCommerce with Sage

Development,Roots,Snippets,WooCommerce,WordPress

A lot has changed in WooCommerce and in Sage since Chris Carr wrote about using WooCommerce with Sage; this post is just a brief update on how to get WooCommerce to play nicely with Sage 8.x.

WooCommerce has a remarkable ability to break after updates. Even if you follow their override best practices you could end up having to update the templates that you’ve overridden, so I like to avoid template overrides unless absolutely necessary (I make ample use of action hooks and filters to reduce overrides). So, to get WooCommerce up and running smoothly and without any major template overrides, here’s what I like to do:

  1. Add add_theme_support('woocommerce'); to the setup function in lib/setup.php
  2. Add remove_all_actions('woocommerce_sidebar'); to the bottom of lib/setup.php
  3. In the theme’s root directory, create header-shop.php and footer-shop.php files and leave them blank

After these additions you should be up and running with WooCommerce and Sage without any errors or duplicate content.


Leave a Comment