• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2665

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

Remove Sidebar on WooCommerce Pages

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';
    }
}

Layout WooCommerce

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems