[Resolved] Shop page no side-bar / product category pages left side-bar

Home Forums Support [Resolved] Shop page no side-bar / product category pages left side-bar

Home Forums Support Shop page no side-bar / product category pages left side-bar

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #327590
    one2love

    I having am trouble finding a filter to make the WooCommerce SHOP base page have NO-SIDEBAR and then have all shop/product archive pages have a LEFT-SIDEBAR?

    I currently have a LEFT-SIDEBAR set.

    #327621
    Manuela

    This is what I found so far: https://docs.generatepress.com/article/sidebar-layout/#metabox

    However, on the cart page, there still is a sidebar that I can’t seem to be able to turn off. The website I’m currently working on is https://gleamliving.com.
    Also, the quantity selector field is missing, so whenever I try to add the product to cart the whole available quantity is added…
    Any ideas Tom?

    Thanks!

    #327717
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    If you turn on our new WooCommerce add-on in GPP 1.3, you can set the sidebar layout in “Customize > Layout > WooCommerce”.

    #327738
    Manuela

    Yes, I already did that…the only woocommerce related page that still has a sidebar is the “cart” one, strangely.

    #327849
    Tom
    Lead Developer
    Lead Developer

    The cart page is a regular WordPress page, so the option to change the page sidebar layout applies to it (Customize > Layout > Sidebars).

    #327932
    one2love

    Hi Tom
    I am aware of the new add-on. It is great, thanks.

    I already have the sidebar set to left using said extension. The problem lies that I want no sidebar on the shop landing page and left on all other shop related archive pages.

    I realise that the shop also uses the default WooCommerce archive template but perhaps there is a trick I am missing – a filter targeting the SHOP landing page specifically?

    Thank you

    #327960
    Tom
    Lead Developer
    Lead Developer

    Ah, you could use this filter: https://docs.generatepress.com/article/sidebar-layout/#using-a-function

    You should find all of the conditionals here: https://docs.woocommerce.com/document/conditional-tags/

    Let me know if you need more info πŸ™‚

    #328638
    one2love

    Great, thanks, Tom. That worked perfectly.

    Anyone looking for this, this is what I used to have the SHOP page have a no sidebar with all other shop archives set to have a sidebar (which you need to set in your theme settings):

    add_filter( 'generate_sidebar_layout','tu_custom_woocommerce_sidebar_layout' );
    function tu_custom_woocommerce_sidebar_layout( $layout )
    {
     	// If we are on a woocommerce page, set the sidebar
     	if ( function_exists( 'is_woocommerce' ) && is_shop() )
     	 	return 'no-sidebar';
    
     	// Or else, set the regular layout
     	return $layout;
    
     }
    #328639
    Tom
    Lead Developer
    Lead Developer

    Thanks for posting the solution! πŸ™‚

    #328977
    Manuela

    Worked for me as well, thank you! πŸ™‚

    #329115
    Tom
    Lead Developer
    Lead Developer

    Awesome! πŸ™‚

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