[Resolved] Any way to disable elements and sidebar for all WooCommerce product pages?

Home Forums Support [Resolved] Any way to disable elements and sidebar for all WooCommerce product pages?

Home Forums Support Any way to disable elements and sidebar for all WooCommerce product pages?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #580186
    Shaun

    Hi guys, I’ve got approximately 100 WooCommerce products that I’ll be importing soon. Is there any way I can mass disable the sidebar and certain elements (e.g. page header) from the individual product pages? Thanks in advance.

    #580226
    Leo
    Staff
    Customer Support

    Hi there,

    Are you wanting sidebar on the main products page? If not then you can just use this setting here:
    https://docs.generatepress.com/article/woocommerce-overview/#shop

    There shouldn’t be page header showing by default unless it was assigned to them in page header global location:
    https://docs.generatepress.com/article/page-header-global-locations/

    Let me know if this helps.

    #580401
    Shaun

    Thanks Leo! I managed to get rid of the sidebar for the products’ pages.

    I also want to specifically disable the Top Bar for these pages. Is there a way to do it en masse?

    #580430
    Leo
    Staff
    Customer Support

    Try this snippet:

    add_action( 'wp', 'lh_disable_woo_topbar' );
    function lh_disable_woo_topbar() {
      if ( is_woocommerce() ) {
        remove_action( 'generate_before_header','generate_top_bar', 5 );
      }
    }
    #580449
    Shaun

    Thanks Leo. Do I just copy and paste this into Simple CSS?

    #580460
    Tom
    Lead Developer
    Lead Developer

    That code can be added using one of these methods: https://docs.generatepress.com/article/adding-php/

    #580471
    Shaun

    Awesome! Thanks Tom and Leo. The code works like a charm!

    #580846
    Tom
    Lead Developer
    Lead Developer

    You’re welcome 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.