Archived topic
Woocommerce Shop page sidebar
17 replies · Started by stardrive on August 13, 2015
Dear Tom,
The Woocommerce Shop page sidebar is now permanently showing the right sidebar. Even when I set the Sidebar Layout in the /shop page to Sidebar/Content or Content (no sidebars), the shop front end display will still be content/sidebar.
Please, kindly assist.
Regards,
Stardrive
Hi there,
WordPress sees the WooCommerce index as the blog page, so the blog layout controls the layout for that page.
You can use a function to set the WooCommerce sidebar to whatever you want: https://generatepress.com/knowledgebase/choosing-sidebar-layouts/#sidebar-filter
Let me know if you need more info :)
Dear Tom,
Please, I used the function below to change the sidebar to left sidebar in all woocommerce category pages. But, it is not working: It is still the right sidebar that is showing in the default shop page and in all category pages
add_filter( 'generate_sidebar_layout','generate_custom_category_sidebar_layout' );
function generate_custom_category_sidebar_layout( $layout )
{
// If we are on a category, set the sidebar
if ( is_category() )
return 'left-sidebar';
// Or else, set the regular layout
return $layout;
}
Regards,
Stardrive
That's for categories.
You're looking for this function:
add_filter( 'generate_sidebar_layout','generate_custom_woocommerce_sidebar_layout' );
function generate_custom_woocommerce_sidebar_layout( $layout )
{
// If we are on a woocommerce page, set the sidebar
if ( is_woocommerce() )
return 'both-left';
// Or else, set the regular layout
return $layout;
}
Dear Tom,
What I actually want is to have the left sidebar show in woocommerce product category pages while the blog right sidebar show in woocommerce single product detail page.
The blog right sidebar is showing in woocommerce single product detail page, which is OK.
But, the blog right sidebar is also showing in woocommerce product category pages, which is not OK; and this is not what i want for woocommerce product category pages. So, I am having issue with the woocommerce product category pages.
Best Regards,
Stardrive
In that case, this code should work:
add_filter( 'generate_sidebar_layout','generate_custom_woocommerce_sidebar_layout' );
function generate_custom_woocommerce_sidebar_layout( $layout )
{
// If we are on a woocommerce page, set the sidebar
if ( is_woocommerce() )
return 'left-sidebar';
// Or else, set the regular layout
return $layout;
}
That should set the left sidebar for any WooCommerce pages, excluding the single product pages.
Dear Tom,
Please, the function did not work. It set the left sidebar for any WooCommerce pages, and including the single product pages.
Regards,
Stardrive
NB:
Sorry for the delayed response. I was communicating with the woocommerce plugin author on the issue with product variation. He found out that Magic Zoom plugin is not compatible with the latest woocommerce version 2.4.3, and that it was magic zoom that was causing product variation not to work. Please, all forum members using magic zoom should note this. See the link of my communication with Mike Jolley:
https://wordpress.org/support/topic/product-variation-no-more-working?replies=20#post-7296590
Dear Tom,
Please, I mean the function did not work. It set the left sidebar to be the sidebar for all WooCommerce pages, including the single product pages.
Try this:
add_filter( 'generate_sidebar_layout','generate_custom_woocommerce_sidebar_layout' );
function generate_custom_woocommerce_sidebar_layout( $layout )
{
// If we are on a woocommerce page, set the sidebar
if ( is_woocommerce() && ! is_single() )
return 'left-sidebar';
// Or else, set the regular layout
return $layout;
}
Great!!
It is working perfectly now.
Thank you so much.
Best Regards,
Stardrive
You're welcome :)
Hi Tom,
Just discovered your Woocommerce section of updated GP Premium - fantastic! Fixes this issue instantly and many others also. Still the best theme and support out there!
Thank you! :)
Hi Tom,
On the same topic I'm experiencing some difficulties myself and I seem not be able to fix it even with the thread here above.
I want on the WC shop page the sidebar on the left and with the products no sidebar.
This is a problem for the new site http://www.wiegenco.nl. I find it strange since on my previous site (www.cribster.nl) the GP layout options do work on the Shop and product pages.
For example product page:
https://www.wiegenco.nl/winkel/merken/snuz/snuzpod3/
For shop page:
https://www.wiegenco.nl/winkel/
I've put the website on visible for the time being so you can take a look, but it is of course still only the rough draft :)
Thank you for your help again!
FYI, already added this snippet:
add_filter( 'generate_sidebar_layout','generate_custom_woocommerce_sidebar_layout' );
function generate_custom_woocommerce_sidebar_layout( $layout )
{
// If we are on a woocommerce page, set the sidebar
if ( is_woocommerce() )
return 'left-sidebar';
// Or else, set the regular layout
return $layout;
}
But of course it only fixed the Shop page.