Hide the product’s weight and dimensions

If you are not selling digital products, you are probably using the weight and dimensions for your products because you need to ship them. At least the weight will be required for all the shipping services.

The “problem” is that when you add those data in the product, they appear in the single product page. How can you hide them?

There’s a very quick way to hide those data since they are not useful to the customers in most cases.

Open your functions.php file located in wp-content/themes/your-theme-name/ and add this code at the end of it:


/**
* Hides the product's weight and dimension in the single product page.
*/
add_filter( 'wc_product_enable_dimensions_display', '__return_false' );

view raw

functions.php

hosted with ❤ by GitHub


More Posts That You Might Like…


40 responses to “Hide the product’s weight and dimensions”

  1. Hi, Nicola!

    Can you please advise on how to change the position of weight and dimensions (1) and the rest of the atributes in the Additional information tab (2)?

    I would like in Additional information tab to have all custom atributes first and right below them – the weight and size.

    How to achieve that?

    1. You need to override the template for the attributes. They are hard coded, can’t be moved without editing the template.

  2. I’d like to change the description text to Shipping Weight, and Shipping Dimensions. The default is confusing, as a shopper might think that information is the actual product weight and/or dimensions. Easy way to do so?

    Also, how about displaying custom meta on the same tab if we created custom meta for actual: product_weight, product_length, product_height, product_width? Possible?

    1. Hi Cliff,
      to change the text you have to replace the template single-product/product-attributes.php in your theme. To learn how, please check this tutorial: https://docs.woothemes.com/document/template-structure/

      The same is needed to add some custom meta to that tab.
      You can copy the table structure from the other data, then print the custom meta value with echo get_post_meta( $product->id, '_custom_meta_name', true );.

      1. I was able to add shipping in front of weight and dimension. Thanks so much!

      2. Danial Siddiqui Avatar
        Danial Siddiqui

        Thx its helps me a lot.

  3. Forgot to follow by email.

  4. Much thanks! Was easy to implement.

    1. You did it! Woo!

  5. Hi,
    The code you advise to add did not work for me …
    Added the code on functions.php but nothing happened, the dimensions are still shown on the single product page 🙁
    Last versions on both WP & Woo

    Any ideas?

    1. Hi,
      Did you try to switch to a different theme?

  6. Hi Nicola, thank a lot!

    I´ve used it with Divi (child) Theme and it works flawlessly.

    1. Hi Rubén,
      Thanks for letting me know and for reading!

      Have a nice day!

  7. Thanks. This worked!

    1. You’re welcome!

  8. Thanks!! So good!

    1. You’re welcome Zawar!

  9. this isnt working now after the newest update please help

    1. Hi Michael,
      I think it is related to a conflict in your site.

      As you can see here the filter is still used, and that function prevents the dimensions and weight to show, here.

      Please test with a different theme or disable the overridden templates, it will probably fix the issue.

  10. Worked perfectly for me thank you

    1. Great! You’re welcome!

  11. Its not work in WC 2.6.8.

    1. Hi Armin,
      I checked in the core of WooCommerce and the filter is still there, as you can see here.

      Maybe you added the code wrongly or something is conflicting with it.

  12. Thanks Nicola, works perfectly!

    1. You’re welcome Paul!

  13. Thank you! It removed the shipping weight but didn’t remove the additional information tab. Can you pretty please help with this?

  14. Hi,

    Thank you very much for the code you have provided. I just copy and past code to funciton.php in theme. Yes, it works! Now weigh has been hideded. I do not want to display the weight since there is no correct weight information is available for my products.

    Thanks again

    Kurban

  15. Awesome. Thank you.

    1. You’re welcome!

  16. Hii! Thanks it worked!
    But, if I want to hide only the dimensions (height/width) and still show the info weight? How do I do that?

    1. Hey Jessie,
      That needs to be done via CSS then, it would be easier.

  17. Thank you very much.
    There is a typo in the filter comment: ‘teh’.

    1. Fixed, thanks.

  18. Hi,
    I’m displaying the product dimensions outside the “additional information” tab using get_weight, get_height, etc
    How do I remove the dimensions only from the product tabs?

    1. If you are using those functions to show the data outside of the tab this code will not affect them.

  19. Works perfectly from the first shot! Thanks for the snippet!

    1. You’re very welcome Paul!

  20. On a variable product page, is there a way to only show this info after a variation has been selected?

    My product comes in different sizes and the additional information tab is useful, but not before a variation has been selected. Before a user has selected a variation the tab just says says “Dimensjons: I/A”. This is unnecessary and doesn’t look very good. I have custom dimensions for each variation.

  21. Wow. Perfect! Nice solution.
    Ciao.

  22. How can I change the display order of the dimensions in admin and to users, like width/height/length?

Leave a Reply

Categories

Newsletter

Receive new articles from this blog directly in your inbox!

No spam guaranteed!

Blog at WordPress.com.

%d bloggers like this: