This tutorial provides 2 ways to remove the sidebar from any type of WooCommerce page in Genesis child themes.
1. You can change the Layout Settings on Edit Product pages and select the full width layout like this:
or
2. Use code with the is_product()
or is_singular( 'product' ) )
conditional tag.
Make sure you have the Genesis WooCommerce Connect plugin activated.
Here’s the code to remove the sidebar from all WooCommerce product pages:
add_filter( 'genesis_pre_get_option_site_layout', 'full_width_layout_product_pages' );
function full_width_layout_product_pages( $opt ) {
if ( is_product() ) {
$opt = 'full-width-content';
return $opt;
}
}
To remove the sidebar from other WooCommerce pages, swap out the is_product conditional tag with any other WooCommerce conditional tag like this :
add_filter( 'genesis_site_layout', 'woocommerce_page_layout' );
function woocommerce_page_layout() {
if ( is_page ( array( 'cart', 'checkout' )) || is_shop() || 'product' == get_post_type() || is_woocommerce() ) {
return 'full-width-content';
}
}
Was This Tutorial Helpful?