Adding support for WooCommerce in Genesis

Posted on

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:

/**
 * 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();