php - Hide product attributes from additional information tab in WooCommerce
415
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
Solution:
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:
1) To remove the product dimensions, you can disable that with the following code:
2) To remove everything from the tab ( weight, dimensions and custom attributes) use this:
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
Answer
Solution:
Using the
functions.php
can cause problems with shipping, see here: https://github.com/woocommerce/woocommerce/issues/5985#issuecomment-322541850Simply copy the
wp-content/plugins/woocommerce/templates/single-product/product-attributes.php
towp-content/themes/YOUR_CHILD_THEME/woocommerce/single-product/product-attributes.php
and add anif
to check for the attribute. (As LoicTheAztec mentioned in #3)This is from WooCommerce 4.4.1:
Answer
Solution:
I was looking for an answer for the same/similar issue, wanting to remove the additional information tab. I came across this post using the woocommerce_product_tabs filter
I added it to functions.php and the additional information tab is no longer added to the page.