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!
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 businessbloomer.com/woocommerce-customization
* @author Rodolfo Melogli, Business Bloomer
* @compatible WooCommerce 7
* @community https://businessbloomer.com/club/
*/
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;
}