Customizing Sidebar on Products Pages

I have customized the sidebar on my Woo Commerce “Store” Page by --going to Appearance/Sidebars --Choosing my customized “Store” sidebar --selecting “Store” in the “All Pages and Posts” window and choosing enable sidebar on Shop index page. And it works.

Now I want all my Product Pages to have the same “Store” sidebar.

But there is not a window where I can select Product Pages for a customized sidebar.

Right now all my product pages have my main sidebar/blog sidebar (instead of a sidebar related to products)

Since product pages are not listed in the Appearance/Sidebar “All Pages and Posts” window. I thought I’d try to accomplish what I wanted by using the “All Taxonomies” Window in the Appearance/Sidebars page. I created a new taxonomy for products called “Product Menu.”

I went again to Appearance/Sidebars — chose my customized “Store” sidebar – selected “Product Menu” as a category to receive the Shop Sidebar. Didn’t work. Product Pages with “Product Menu” checked off still don’t display the “Store” Sidebar.

I am wondering if there is a basic way of making my “Store” custom sidebar show up on all my product pages. I will attach my credentials since one of your staff asked for them on this issue.

Hello There,

Thanks for writing in! Regretfully the given credentials is not working for us. Please double check it so that we can take a closer look at your site.

By the way, did you have created a sidebar for you shop page? If that is the case, please add this following code in your child theme’s functions.php file

add_filter( 'ups_sidebar', 'x_woocommerce_sidebar' );
function x_woocommerce_sidebar($sidebar){
	if( x_is_product_category() || x_is_product()){
		return 'ups-sidebar-shop';
	}
	return $sidebar;
}

Please make use that the sidebar ID ups-sidebar-shop is correct or the same ID that you have created which you might need to replace in the code above. This should display the sidebar in a product page and the product category or taxonomy page.

Please let us know how it goes.

Hi Rue,

I tried your code and only made one small change (per your recommendation), my sidebar is called store. So I added your code like this:
add_filter( ‘ups_sidebar’, ‘x_woocommerce_sidebar’ );
function x_woocommerce_sidebar($sidebar){
if( x_is_product_category() || x_is_product()){
return ‘ups-sidebar-store’;
}
return $sidebar;
}

Worked great. Thanks to you!

On behalf of my colleague, you’re welcome. Cheers!