Skip Navigation

[Resolved] Remove sidebar from woocommerce product pages

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to remove the sidebar from WooCommerce Product pages.

Solution: It depends on your theme, and whether or not you are using Layouts. Some themes provide Theme Options that allow you to turn sidebars on or off on particular pages. Some popular themes already have these options integrated in Layouts, so you can select Theme Options for each Layout.

Some themes hard-code this sidebar in PHP and there's nothing WooCommerce Views can do about it. In that case, you must create your own custom PHP template to remove the sidebar. If your theme has a full-width PHP template (which does not use a sidebar), you can copy that file from your parent theme and save it as single-product.php in wp-content/themes/your-child-theme/woocommerce. This will override the default product page design and remove the sidebar. Then WooCommerce Views can be used to design the main content area when you select "Your Child Theme Custom Product Template"

Relevant Documentation: https://developer.wordpress.org/themes/basics/template-hierarchy/

https://toolset.com/documentation/user-guides/getting-started-woocommerce-views/

This support ticket is created 7 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 8 replies, has 2 voices.

Last updated by Nicholas 6 years, 12 months ago.

Assisted by: Christian Cox.

Author
Posts
#588915
sidebar-bug.png

Hello I am using the woocommerce views plugin to create my own product template.
For some reason the default wordpress sidebar is automatically displayed below the footer. I cannot control it with woocommerce views.
I tried moving it above the footer by adding a widget area cell below the content template of my layout.
But this just added the same default wp sidebar again. (see image)

My questions is: How do I remove the sidebar/widget area that is automatically added to the product pages?
I tseems like that I cannot remove the default wordpress sidebar.
Please let me know if you know of a way how to remove it.

Regards,
Nicholas

#588978

My questions is: How do I remove the sidebar/widget area that is automatically added to the product pages?
It depends on your theme, and whether or not you are using Layouts. Some themes provide Theme Options that allow you to turn sidebars on or off on particular pages. Some popular themes already have these options integrated in Layouts, so you can select Theme Options for each Layout.

Some themes hard-code this sidebar in PHP and there's nothing WooCommerce Views can do about it. In that case, you must create your own custom PHP template to remove the sidebar. If your theme has a full-width PHP template (which does not use a sidebar), you can copy that file from your parent theme and save it as single-product.php in a child theme. This will override the default product page design and remove the sidebar. Then WooCommerce Views can be used to design the main content area.

More info about WordPress template hierarchy here:
https://developer.wordpress.org/themes/basics/template-hierarchy/

#589019

I am using the Toolset Starter and Toolset Starter Childe Theme. I forgot to add that when creating that ticket. sorry about that.

#589021
Screen Shot 2017-11-13 at 7.20.18 AM.png

so i copied the single-product.php file to my child theme. there i noticed that the sidebar was above the footer. i deleted it but the sidebar was still not gone. maybe that's because I am using toolset woocommerce views
anyhow.
the reason why i am using toolset woocommerce views is not to mess with php templates so how can remove the sidebar using toolset woocommerce views ?

#589226

so i copied the single-product.php file to my child theme. there i noticed that the sidebar was above the footer.
Once you copy single-product.php into wp-content/themes/toolset-starter-child/woocommerce, then you must make a change in Toolset > WooCommerce Views. In the Product Template file settings you must choose "Toolset Starter Child Theme Custom Product Template" in order to apply the changes you have made in single-product.php. Commenting out do_action('woocommerce_sidebar') should be enough.

#589231
Screen Shot 2017-11-13 at 7.10.18 PM.png

hm i did exactly what you said but I don't see the copied template (see screenshot)

I copied the template from the woocommerce plugin to the child theme. I followed your instructions.

#589233

My bad. I got it to work. I copied the wrong template.

Is there a way to remove the sidebar without changing any of the templates?

May I make this a feature request, because I thought Toolset wc views allows you to do that.

#589262

Is there a way to remove the sidebar without changing any of the templates?
Content Templates in general are designed to replace "the_content()" to modify the main content area of your site. That's why things like your header and main navigation remain intact - only the main content portion should be affected. In your theme, the main content area does not include the sidebar as part of the_content(), it's triggered by the code

do_action('woocommerce_sidebar');

The most practical way to handle it is by making an adjustment in the template file for products. It may be possible to implement some kind of filter from your theme to filter out the sidebar here, but it's usually faster just to override the PHP template file because different themes handle this different ways.

#589263

Thank you Christian.