Add or Change Content of Default Product Tabs

In this tutorial we are going to talk about WooCommerce product tabs, the default ones – “Description”, “Additional information” and “Reviews” tab. First of all I will show you how to add default content into them and then we will also add something custom as well.

Description tab

You probably know that the Description tab just displays the text or HTML added into the main content area of a product.

Main content area of WooCommerce products

Here we are.

WooCommerce description product tab default content

If you’re trying to figure it out how to change the Description tab title, this is just for you.

Modify Description tab content programmatically

There is no specific hook for this tab, but you can use the_content filter hook, all right?

/**
 * Add Description tab content programmatically
 *
 * @author Misha Rudrastyh
 * @url https://rudrastyh.com/woocommerce/add-or-change-default-tab-content.html#description-tab
 */
add_filter( 'the_content', 'misha_add_something_description_tab' );

function misha_add_something_description_tab( $content ){
	if( is_product() ) { // I recommend to always use this condition
		$content .= '<p>Your custom text or HTML.</p>';
	}
	return $content;
};
Add custom text to description product tab in WooCommerce

You can also apply your modifications only for specific products or only to products in specific categories. global $product object will help you with that.

// apply to a specific product only
if( is_product() && 10 == $product->get_id() ) {
// apply to a specific product categories only
if( is_product() && has_term( array( 'sneakers', 'backpacks' ), 'product_cat', $product->get_id() ) ) {

And of course, you can completely change this tab template which is /single-product/tabs/description.php, but I recommend you to avoid that at any costs.

Additional Information

Before we start talking about this tab, I would like to highlight some of my tutorial where it is described how you can remove additional information tab completely or how to change its title.

How to add Additional Information in WooCommerce products?

I would like to remind you that the default content of this tab is the product attributes table. If no attributes added, the tab won’t be displayed.

product attributes in WooCommerce
WooCommerce additional information tab with product attributes are being displayed

Custom Additional Information

This tab allows to add your custom content before or after the default tab content with woocommerce_product_additional_information action hook.

/**
 * Add Additional Information tab content programmatically
 *
 * @author Misha Rudrastyh
 * @url https://rudrastyh.com/woocommerce/add-or-change-default-tab-content.html#additional-information-tab
 */
add_filter( 'woocommerce_product_additional_information', 'misha_add_content', 9 );

function misha_add_content( $product ){
	echo '<p>Your custom text or HTML.</p>';
}
  • Use priority 9 or below to add something before the product attributes table,
  • Use priority 11 or higher to add something after the product attributes.
Add custom content to the additional information WooCommerce product tab

You can also use conditions based on a product object like if( 10 == $product->get_id() ).

It seems like you don’t need to edit the template of this tab, but just in a case you can find it in: /single-product/tabs/additional-information.php

Review tab

The last but least, the Reviews tab. You can find this tab template single-product-reviews.php directly in woocommerce/templates directory.

That’s all 😁

Would like to add some custom text or HTML to the Reviews tab? You have to rewrite the template in this case or change this tab callback function. No other ways. If you know another way, please let me know in comments below.

Change Product Tab Callback Function

There is one more way to change any product tab content – just replace its callback function.

Please note, that changing the function doesn’t change the tab behaviour, for example if the main content area of a product is empty, the tab won’t be displayed no matter what you set as a callback function.

Here is the example of the code.

add_filter( 'woocommerce_product_tabs', 'misha_customize_description_tab' );

function misha_customize_description_tab( $tabs ) {
	
	$tabs[ 'description' ][ 'callback' ] = 'misha_custom_description_callback';
	return $tabs;
	
}

function misha_custom_description_callback() {
	
	echo '<h2>Custom Description Tab Title</h2>';
	echo '<p>Custom description tab content</p>';
	
}
Misha Rudrastyh

Misha Rudrastyh

Hey guys and welcome to my website. For more than 10 years I've been doing my best to share with you some superb WordPress guides and tips for free.

Need some developer help? Contact me

Follow me on X