Hide product attributes from additional information tab in WooCommerce

romu picture romu · Dec 24, 2017 · Viewed 8k times · Source

How to hide certain custom product attributes on single product pages additional informations tab?

Note: I don´t want to hide everything, just specific attributes.

For e.g i would like to hide "pa_size" to name one it it.

Only found this one, but its for a products weight.

add_filter( 'woocommerce_product_get_weight' , '__return_false' );

Answer

LoicTheAztec picture LoicTheAztec · Dec 24, 2017

For all custom product attributes you can hide them from additional information tab just deselecting the option "Visible on the product page" under product settings > Attributes tab:

enter image description here

1) To remove the product dimensions, you can disable that with the following code:

add_filter( 'woocommerce_product_get_dimensions', '__return_false' );

2) To remove everything from the tab ( weight, dimensions and custom attributes) use this:

remove_action( 'woocommerce_product_additional_information', 'wc_display_product_attributes', 10 );

3) To fine tune what you want to display:

You can override single-product/product-attributes.php template via your active child theme (or active theme) that displays everything in this product tab.

So you can remove any html block, that displays those details, or customize it…


Official documentation: Template structure & Overriding templates via a theme