How To: Remove WooCommerce Sidebar

Here’s another snippet to remove WooCommerce sidebar in all single product pages, category or in specific product page only, sure you can remove the sidebar using CSS code but it’s not the good solution and for me it is ugliest solution out there, so in here we’re using hook, Woo recommended using hook for developer instead of touching or overwriting template file.

Without further ado lets get started.

Single Product Page

Remove sidebar in all single product pages

Specific Product Page

To remove sidebar on specific product page only, just add product ID in IF statement

All Pages

To remove sidebar in all pages including category then use this code instead

Customising the full-width display is not covered in this tutorial.

Happy Coding ^_^

by Ryan Sutana

  • the code to remove it from all pages works just fine. thank you!

  • simongarlick

    none of these work for me under WC 2.2.10.

    • Nothing change in latest version of WooCommerce sidebar hook, so it should work, just make sure you’ve added it in functions.php file or your current theme, increase the priority if needed it might conflict with the theme you’re currently using specially premium theme.

      • simongarlick

        Fresh install of Woothemes Canvas framework, no child theme, nothing else in functions.php. Plugin conflict maybe?

        • Lets try troubleshooting
          1. Disable all plugins and see if it works
          2. If not, then try the default theme while plugins are all disabled

  • Barry Veinotte

    Any way to achieve this with an entire category of products?

    • Hi you can use
      is_product_category() to target all category or
      is_product_category( ‘shirts’ ) for single category and
      is_product_category( array( ‘shirts’, ‘games’ ) ) for lists of product category

      Hope that helps

      • Barry Veinotte

        Awesome! Thanks for the tips. Off to try this one now.

  • Edward

    I’m trying this using the Code Snippets plugin. No luck. Any advice?

    • Make sure you’ve added the code in functions.php file.

  • interslice

    great stuff but – wtf is a hook? 😉
    Throw the above code in the functions.php file – check …
    then the only hook i can find is from a captain and he looks pretty pissed at me right now!