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

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
 * @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;
}

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

  • WooCommerce: Custom Add to Cart URLs – The Ultimate Guide
    In WooCommerce you can add a product to the cart via a custom link. You just need to use the “add-to-cart” URL parameter followed by the product ID. This tutorial will show you how to create custom URLs to add simple, variable and grouped products to the cart – as well as defining the add […]
  • WooCommerce: Add Custom Field to Product Variations
    Adding and displaying custom fields on WooCommerce products is quite simple. For example, you can add a “RRP/MSRP” field to a product, or maybe use ACF and display its value on the single product page. Easy, yes. Unfortunately, the above only applies to “simple” products without variations (or the parent product if it’s a variable […]
  • WooCommerce: Move Product Tabs Under the Short Description
    When the long description is very short, you may want to move the whole block of “product tabs” to the right hand side of the product image – as opposed to wasting a lot of space underneath it. So, here’s how you can remove the product tabs from their original position, and display them beside […]
  • WooCommerce: Remove Additional Information Tab @ Single Product
    The “Additional Information” tab on the single product page is somewhat annoying and, honestly, quite useless. There are 2 simple methods to “hide” it or delete it completely: a CSS and a PHP solution. In the first case, you can input the code in your style.css; in the second case use your child theme’s functions.php. […]
  • WooCommerce: Display “FREE” Instead of $0.00 Price
    In older versions of WooCommerce free prices used to display as “FREE!” and products with empty prices were not publishable/purchasable. Now they’ve changed this around, but I still believe “FREE” looks much better than “$0.00”. It’s much more enticing, isn’t it? Well, here’s how you restore the old WooCommerce functionality – as usual it’s as […]

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

Questions? Feedback? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

Your email address will not be published. Required fields are marked *