WooCommerce removing the reviews tab

May 15th, 2012 by Sean Barton Leave a reply »

UPDATE: If you are using WooCommerce 2.0+ then you need to read this blog post I wrote instead which explains the ‘new’ system for you.

Another quickie from me today. I have been using WooCommerce a lot recently but there are just some options that could do with making into options or filters I think. As I understand it’s a JigoShop rebadge with a bit of Woo goodness in there for luck and it seems to be paying off. I never want to use WP Ecommerce again at this rate.

Each WooCommerce installation will have the reviews tabs added to individual product pages. As I understand it it uses the WordPress comment system to hold review information (so says one forum, i’ve not bothered to check it out). I noted that people are wanting to know how to turn this functionality off as reviews don’t really apply to all products in all shops. Adding this code to your theme functions.php file will remove the reviews tab. If you want it back then just remove the lines.. simples.

remove_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30);
remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 30);

Edit:

People have asked how to remove the product attributes tab and the additional description tab also. You can do so using the following code:
remove_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10);
remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel', 10);
remove_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20);
remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_attributes_panel', 20);

Also see my new tutorial in how to add a new tab to the WooCommerce product pages

43 comments

  1. Robert says:

    Sean, I am using woocommerce inside of a site I am building with Ultimatum. It’s a custom theme builder if you’re not familiar. Anyway, I’ve been trying desperately to remove all product images, as they are not relevant to what is being sold. However, all the advice I am finding online is not working.

    I tried inserting the code you gave here, but it had not effect. Is there a certain place inside of the functions.php file that I am supposed to put it to make it work?

    Thanks for your help.

  2. Guillaume says:

    HI!

    Thanks for the non-review code, it works just fine! I’m looking to suppress the “description” tab that’s just beside the “review” tab in the product page… Could you give me the code?

    Thanks a lot!

    Guillaume

    • Sean says:

      Hey, these are the lines that add those panels. You will recognise the bottom one of each section as reviews. just use the appropriate string from these to remove the others if you like. Let me know if you need any help.

      ta
      S

      add_action( ‘woocommerce_product_tabs’, ‘woocommerce_product_description_tab’, 10 );
      add_action( ‘woocommerce_product_tabs’, ‘woocommerce_product_attributes_tab’, 20 );
      add_action( ‘woocommerce_product_tabs’, ‘woocommerce_product_reviews_tab’, 30 );

      add_action( ‘woocommerce_product_tab_panels’, ‘woocommerce_product_description_panel’, 10 );
      add_action( ‘woocommerce_product_tab_panels’, ‘woocommerce_product_attributes_panel’, 20 );
      add_action( ‘woocommerce_product_tab_panels’, ‘woocommerce_product_reviews_panel’, 30 );

  3. Daniel says:

    hi,

    i want to remove the “sumit yours” link and set a form like a contact form to teh revies, do you have a tutorial for this?

    Greets,
    dan

    • Sean says:

      hi Dan, sorry about the delay on this but yes I do have that tutorial now written. Check out my latest post on the site. You can remove the review tab using the code in the post above and you can add a new tab using the following blog post.

      Any more ideas please let me know.

      ta
      S

  4. Guillaume says:

    Hi Sean,

    Thanks a lot, but I still can’t figure out which line I should include in the file…

    Thanks

  5. Mick Buckley says:

    Hi Sean, I grew up in Crewe but now I’m a website developer living in New Zealand. I needed to remove the Additional Information and Review tabs on a Woocommerce site I’m building this page came up first hit on Google. Thanks! Now I’ll think of Crewe every time I browse the product catalog.

    • Sean says:

      Hey Mick, wow you got out. Nice one :) I live in Wistaston thankfully on the outskirts so not quite the war zone. Glad you got it sorted. By all means let me know if you need anything else. Always happy to help.

      thanks
      Sean

  6. Gene says:

    Hi Sean,

    Thanks for the code snippet, works great!

    I’m wondering if you know how to remove the related products section that appears below the tabs… I found this snippet on the WP forums but it doesn’t seem to work for me.

    remove_action( ‘woocommerce_after_single_product_summary’, ‘woocommerce_output_related_products’, 20);

    • Sean says:

      Hi Gene,

      Thanks for your comment. That snippet is correct but it depends on placement and load order. Put it in your functions.php file for your theme for starters. If that doesn’t work then add it into a code block called by another function or hook

      add_action text123() {
      remove_action( ‘woocommerce_after_single_product_summary’, ‘woocommerce_output_related_products’, 20);
      }

      add_action(‘init’, ‘text123′,30);

      It might help. Let me know

      thanks
      Sean

  7. Mark says:

    I’m using woocommerce Version 1.6.6. The above didn’t work for me. I did however find a very simple solution.

    Assuming you have copied the template files from the plugin to a woocommerce folder within your theme. You will find that these tabs now have there own template files.
    your folder > single-product > tabs > tab-reviews.php

    To remove display of the tab on the front end
    simply open the file and modify as below:

    add <!– before the first and add –> after the Save the file and voila no more review tab!

    This can be repeated for the attributes tab and the description tab.

    • Sean says:

      Hi Mark,

      Though I agree that is one method of removing the tab it does actually still show it. You are simply suggesting that we hide it from view using an HTML comment.

      My method does work. Perhaps conflicts with implementation maybe. Not sure although I used the same code this morning with no issue. However your approach is still valid. I would simply use the following code though:

      < ?php return; ?> which should cause the tab to disappear or indeed just delete the contents of that file.

      thanks
      Sean

      • Mark says:

        Sean

        Thank you for your quick reply. I wasn’t saying that you method didn’t work at all
        I was saying that it didn’t work for me.
        I’m fully aware that the code you provide goes into my functions.php file.
        You are correct that removing the line entirely would also serve the same purpose. However, I have opted to comment out the line for convenience as clients often change their minds!!
        You are incorrect in saying that the tabs does actually show as it doesn’t show at all. In fact any code that you comment out correctly will not show in a browser (it is present in the source code though)
        Another way of achieving the same is to set #tab-reviews to display:none in the stylesheet.

        Many Thanks

        Mark

        • Sean says:

          Thanks Mark,

          I wanted to make it clear to people that the code does work is all. Your method is, of course, valid although my point perhaps not explained properly. I was incorrect in saying it shows it but the next sentence highlighted my point. The user still has to download that markup in order for it to be hidden in the background and not used. A PHP commect, is using that method, would be more appropriate as the markup would not be sent to the browser at all.

          What theme are you using by the way? There must be a reason that the action can not be removed using my standard method.

          ta
          S

          • Mark says:

            Sean

            Xing – Woocommerce – Themeforest.

            Although I wish i’d of coded the whole thing myself from scratch now!! I’ve practically had to rewrite the stylesheet.

            Can’t say why it didn’t work. Theme hooks, woocommerce hook changes, maybe even WP 3.5.1 conflict (doubtful)

            I could install debugthis plugin and find out but frankly I want to get this project out and billed as its boring me to distraction…

            You will never ever write a piece of code that works for 100% of people… too many different server environments and too many different theme and plugin setups.

            BTW I’ll be removing it later to a when I go through the minification and optimisation stage

            Cheers

            M

  8. Vladimir says:

    Hi Sean,

    My goal is – remove tabs, but leave description text only.
    Is it possible to do with remove_action()?
    Or his here one way – edit templates?

    • Sean says:

      Hi Vladimir,

      I think this is possible if you just remove the tab portion and not the panel?

      Let me know how you get on.

      thanks
      Sean

      • Vladimir says:

        Hi Sean,

        Thank you for advice.
        I tried all variants, but no luck :(

        For now I just setup “display: none;” in css for class “tabs”. Not good solution, but I do not see better variants for now.

  9. Tarek says:

    Where is “theme functions” located?

    I see /admin/woocommerce-admin-functions.php
    woocommerce/woocommerce-functions.php
    woocommerce/woocommerce-core-functions.php

  10. Fritz says:

    Great stuff here, thanks for sharing!

    What I need to do is a bit different…maybe a subject for a separate post/tutorial. I don’t want to hide the Reviews tab. I want it to show but I want only registered (logged in) users to be able to leave a product review (to reduce spam.) Of course everyone should be able to see the reviews.

    Thanks in advance for any help you can give on this!

    • Sean says:

      Hey Fritz,

      Actually this is quite simple in the WooCommerce 2.0 system. Use the following code:

      add_filter( 'woocommerce_product_tabs', 'sb_woo_remove_reviews_tab', 98);

      function sb_woo_remove_reviews_tab($tabs) {
      if (!is_user_logged_in()) {
      unset($tabs['reviews']);
      }

      return $tabs;
      }

  11. Pranjal says:

    Hello Sean,

    I need your little help, can you please tell me how to change the title of the review tab to something else. Actually, instead of Review (count), I want to rename it to User Review (count). Will you please guide me where to edit the following title?

    Thanks

  12. Chad says:

    Hello Sean!

    I’m a noob with woocommerce and I am simply trying to move the tabs (prod. desc. and reviews) out of the main content and add it under the sidebar call so I can have the tabs under both the main content and the sidebar. Unfortunately it hasn’t been so simple to accomplish.

    Any help would be greatly appreciated!

    • Sean says:

      Hey Chad,

      You could do this using the custom template option in WooCommerce and moving the tab content away. It’s no quick job for an amateur though if you don’t have the ability with PHP or WooCommerce.

      thanks
      Sean

  13. Allen says:

    Hey Sean, Seems like you may be my best option here…

    I have a site where the client wants their reviews on it’s own “review” page. Is there a way to accomplish this?

    Thanks much in advance for any help!!!

    – Allen

    • Sean says:

      Thanks Allen,

      I would suggest you use a testimonials plugin and call it reviews instead. Then just add the testimonial form to each product page in a new tab following my WooCommerce new tab tutorial.

      thanks
      Sean

  14. Dan says:

    I can’t for the life of me get this to work. Using latest version of Woocommerce and WP, to know avail. Been adding to the theme functions.php file, and it does nothing. Where am I going wrong?

    • Sean says:

      You would need to use the latest version of the code. WooCommerce changed their code structure for V2 and this blog post relates to pre-2.0. See the related post for the solution.

      thanks
      Sean

  15. Deepz says:

    Can you please help me,how to add really simple captcha to woocommerce review system?.Which file i should edit for that ?…etc

    • Sean says:

      Hi Deepz,

      Because the review system is based on the comment system in WP any normal comment Captcha should work. I like WP Recaptcha because its operated by Google and reliable.

      thanks
      Sean

Leave a Reply