After some testing, found out that template overrides do not work with this method. You are advised to use Genesis Connect for WooCommerce instead of this method.
The code below is a modification of Josh Mallard’s by Stéphane Bergeron.
There is Genesis Connect for WooCommerce plugin but I prefer this method personally.
1) Add the following in child theme’s functions.php:
// Declare WooCommerce support for your theme | |
add_theme_support( 'woocommerce' ); |
2) Create a file named woocommerce.php in the child theme directory having the following code:
<?php | |
/** | |
* WooCommerce Template | |
* | |
* Template used for all WooCommerce views in order to avoid using Genesis Connect | |
* | |
*/ | |
//* Add WooCommerce content output | |
if ( function_exists( 'woocommerce_content' ) ) { | |
// Remove standard post content output | |
remove_action( 'genesis_loop', 'genesis_do_loop'); | |
// Replace the default Genesis loop with WooCommerce's | |
add_action( 'genesis_loop', 'woocommerce_content' ); | |
} | |
genesis(); |
Works for me!
Thanks Sridhar! For the record I think it’s good to point out that Genesis Connect does a lot more e.g. adding templates needed to display the single product page, the main shop page, and Product Category and Product Tag archive pages. It also makes Genesis Simple Sidebars and Genesis Simple Menus compatible with WooCommerce. Your solution above is a lot more minimalist and best for small shops in my opinion 🙂
Thanks David.
All the views were working fine with the above method. I will compare them with Genesis Connect and see if anything’s missing.
After testing the earlier one, I’ll udpate my post with this point. For sites I develop, I do not use Simple Sidebars or Simple Menus (do it via code if needed) but I understand many others use them.
Perhaps another (optional) addition to these snippets is to add support for post layouts and SEO settings:
add_post_type_support( 'product', array( 'genesis-layouts', 'genesis-seo' ) );
@sridhar I have the above code in a site I am developing now. If I take the code out and add the Connect plugin, will I break the site or lose product pages already made?
I just had to rebuild an entire site when the client switched from ecwid to woocommerce, the genesis template executive pro , even with the Connect plugin just did not have the necessary views and structure for the shopping cart, Now I am challenged with having to modify the mystile template in woocommerce, to get the same look!
Hi Sridhar
I tried my first woocommerce/genesis integration using the genesis connect plugin, but the woo commerce cart widget in the sidebar does not work, any ideas? I have added below to function.php
// Enable shortcodes in widgets
add_filter(‘widget_text’, ‘do_shortcode’);
http://petreleo.com/site/ when you add something to cart, the cart page updates, but the sidebar widget does not.
Hi Carin,
I just tried the official Genesis connect plugin for WooCommerce in a new install with Education Pro as the active theme and it is working fine.
I dragged the WooCommerce Cart widget into a sidebar, went to a product page, added the product to cart and the page refreshed and shows the updated cart info in the widget.