Menu Close

WooCommerce: Hide Specific “Additional Information” Tab Attribute @ Single Product

default

WooCommerce variable products display the list of attributes and their terms in the “Additional Information” tab on the single product page. For example, it will display “Color: red, yellow” and “Size: large, small” if your variable product uses those attribute terms to generate variations.

Yes, you could completely remove the “Additional Information” tab all together, but sometimes you may need to just hide a specific attribute in this table, for whatever reason. Especially when you want to avoid your customers getting confused and abandoning your website.

So, here’s the fix. Enjoy!

Let’s say that I want to hide the “Color” row in the Additional Information tab attribute table. The snippet below gives you a super easy fix to achieve that on a global basis.

PHP Snippet: Hide 1 Attribute Row @ Additional Information Tab’s Attributes Table

Note – I’m hiding the color attribute, so in the snippet I use the “attribute_pa_color” key. If you wish to target a different attribute, change that key accordingly.

/**
 * @snippet       Hide attribute @ WooCommerce single product
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 7
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_filter( 'woocommerce_display_product_attributes', 'bbloomer_exclude_attribute_from_attribute_table', 9999, 2 );

function bbloomer_exclude_attribute_from_attribute_table( $product_attributes, $product ) {
	if ( isset( $product_attributes[ 'attribute_pa_color' ] ) ) unset( $product_attributes[ 'attribute_pa_color' ] );
	return $product_attributes;
}
View Source
Posted in WooCommerce Tips