Archived topic
Shop page no side-bar / product category pages left side-bar
10 replies · Started by one2love on June 2, 2017
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.
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!
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".
Yes, I already did that...the only woocommerce related page that still has a sidebar is the "cart" one, strangely.
The cart page is a regular WordPress page, so the option to change the page sidebar layout applies to it (Customize > Layout > Sidebars).
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
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 :)
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;
}
Thanks for posting the solution! :)
Worked for me as well, thank you! :)
Awesome! :)