skip to Main Content

I have installed WooCommerce in WordPress and it will act as a sub section for my website. I have a non-WooCommerce related Sidebar widget that appears on the homepage of my website and after installing WooCommerce, that same widget is appearing on the single-product.php page.

All documentation that describes removing the sidebar from this page, are referring to WooCommerces’ own sidebar widget, which is not the case here. What do I have to do to prevent my homepage sidebar widget from displaying on my WooCommerce Products page?

2

Answers


  1. Chosen as BEST ANSWER

    I figured out the issue. I have a file on my theme called sidebar.php. I couldn't figure out why, but this file was being pulled into single-product.php in woocommerce/templates/. Once I realized that, I just wrote a quick script to tell sidebar.php to only display on the homepage and appear hidden on any other page. Thank you everyone for your help!


  2. The reason is both sidebar files may have the same file name sidebar.php like.
    Woocommerce is using the ‘sidebar.php’. So please rename the homepage sidebar
    widget file to ‘sidebar-home.php’ and call it as get_sidebar(‘home’); in the
    homepage template.
    Then check

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search