[Solved] Removing the sidebar from woocommerce pages

Hi there,

Could some please explain how I remove the sidebar from my woocommerce shop and product pages ( more specifically the ‘archive-product.php’ and the ‘single-product.php’ template files).

I have been struggling with this for a while now and would really appreciate some insight!

Thank you for your time!


I suggest you read this post: http://roots.io/using-woocommerce-with-roots/. it explains in detail how to use WooCommerce with Roots.

1 Like

Okay, so I’ve added ‘is_single’, and ‘is_archive’ to the ‘roots_display_sidebar’ function, which has indeed removed the sidebar on the shop pages, so thank you!

To continue moving forward I now need to wrap a container div around the the ‘single.php’ and ‘archive.php’ content… can you advise me on the best way of doing that?

And thank you so much for your reply, really appreciate your help :slight_smile:

The post @slobich linked to literally contains all the information you need to work with WooCommerce using Roots. Give it a thorough read and don’t forget to check out some of the tips in the recent comments!

1 Like

I’ve read it a few times and it doesn’t explain how to remove the sidebar. Could you please break it down into steps? I’m somewhat off a beginner!

And thank you for your reply!

Please clarify your questions. Your response to @slobich makes it seem like you’re asking how to add markup to your single.php and archive.php templates but your reply to me seems like you’re still having issues removing the Roots (or WooCommerce?) sidebar.

NB, the post does allude to how the sidebar works in WooCommerce templates. Take a look at the Roots Sidebar docs if you’re confused about that.

1 Like

Well, assuming that I’m doing this the best way - To clarify my question and following on from my response to @slobich … how do I add markup to the single.php and archive.php files?

Thank you for your time!

That’s not really a Roots question. But you would need to actually open up the files and then use your keyboard to add the markup you want.

1 Like

Okay, problem solved!

If anyone else is struggling to remove the sidebar from woo commerce pages here’s what I did.

I added is_woocommerce to the roots_display_sidebar function to lib/config.php.

Bosh, done.