How to create, remove, rename and re-order Woocommerce product tabs?

Sometimes those three default Woocommerce product tabs are not enough form you and you need to add your own custom tabs. There are a lot of plugins available for this but why add another plugin if you can do it with the couple of lines of copy and pasting. So, if you want to know how to create, remove, rename and reorder Woocommerce product tabs then keep reading.

How to remove Woocommerce product tabs?

Take a look at this code here below. Just copy it and paste it you your child theme’s function.php file. I would not recommend it though since you’ll lose custom tabs after switching your theme in the future. If you need a solution which does not depend on the theme then install a Code Snippets plugin which lets you add these kinds of snippets without any worries.

add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );

function woo_remove_product_tabs( $tabs ) {

    unset( $tabs['description'] );      	// Remove the description tab
    unset( $tabs['reviews'] ); 			// Remove the reviews tab
    unset( $tabs['additional_information'] );  	// Remove the additional information tab

    return $tabs;
}

How to rename Woocommerce product tabs?

Take a look at the code here below and add it to your Code snippets.

add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
function woo_rename_tabs( $tabs ) {

	$tabs['description']['title'] = __( 'More Information' );		// Rename the description tab
	$tabs['reviews']['title'] = __( 'Ratings' );				// Rename the reviews tab
	$tabs['additional_information']['title'] = __( 'Product Data' );	// Rename the additional information tab

	return $tabs;

}

How to re-order Woocommerce product tabs?

There are times when you just need to re-order your Woocommerce product tabs. If so, then use this code here below. Take a look at the priority numbers (5, 10 and 15). Tab with the lowest priority number is shown first.

add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
function woo_reorder_tabs( $tabs ) {

	$tabs['reviews']['priority'] = 5;			// Reviews first
	$tabs['description']['priority'] = 10;			// Description second
	$tabs['additional_information']['priority'] = 15;	// Additional information third

	return $tabs;
}

How to create custom Woocommerce product tab?

Now lets create a custom Woocommerce product tab which is shown for all products. We’ll call this tab a “Measurement charts”

add_filter( 'woocommerce_product_tabs', 'custom_tab' );
function custom_tab( $tabs ) {	
	// Adds the new tab
	$tabs['test_tab'] = array(
		'title' 	=> __( 'Measurement charts', 'woocommerce' ),
		'priority' 	=> 50,
		'callback' 	=> 'custom_tab_content'
	);
	return $tabs;
}
function custom_tab_content() {

	// The new tab content

	echo '<h2>Measurement charts</h2>';
	echo '<p>Lorem ipsum dolor sit amet consectetur adipiscing elit ultricies convallis volutpat, placerat proin scelerisque eget velit tellus at nibh risus. </p>';
	
}

How to create Woocommerce Conditional Product Tabs?

Well, sometimes you just need to show a custom product tab for one product and another one for other products. Therefore, in this example I am creating two custom tabs and I‘m going to show then condtiionally.

  • first custom product tab is shown only for products in Music category
  • second custom product tab is shown only for products in Pants category
// Conditional tabs

add_filter( 'woocommerce_product_tabs', 'custom_tabs' );
function custom_tabs( $tabs ) {
	// Adds the new tab
if ( has_term( 'music', 'product_cat' ) ) { // Shows tab only for Music category. Here goes the category slug
$tabs['enquiry'] = array(
'title' => __( 'Send enquiry', 'woocommerce' ),
'priority' => 50,
'callback' => 'custom_tab_content1'
);
}
 elseif ( has_term( 'pants', 'product_cat' ) ) { // Shows tab only for Decor category. Here goes the category slug
$tabs['enquiry'] = array(
'title' => __( 'Shipping information', 'woocommerce' ),
'priority' => 50,
'callback' => 'custom_tab_content1'
);
}
	return $tabs;
}
function custom_tab_content1() {
	// The new tab content
if ( has_term( 'music', 'product_cat' ) ) { // Shows tab only for Music category. Here goes the category slug
	echo '<h2>Send enquiry</h2>';
	echo '<p>Lorem ipsum dolor sit amet consectetur adipiscing elit nostra egestas, ultrices sociosqu maecenas netus lacinia id magna porta proin, vel justo imperdiet aliquet volutpat aliquam risus elementum.</p>';
	echo do_shortcode('[fluentform id="1"]');
	}
  elseif ( has_term( 'pants', 'product_cat' ) ) { // Shows tab only for Decor category. Here goes the category slug
	echo do_shortcode('[reblex id="1346"]');
  }
}

How to move Woocommerce single product short description under a tab

This shortcode will remove Woocommerce single product short description, then creates a new tab called Short description and moves short description over there.

// Remove short description
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );

// Add short description to a custom product tab
add_filter( 'woocommerce_product_tabs', 'add_custom_product_tab', 10, 1 );
function add_custom_product_tab( $tabs ) {

    $custom_tab = array(
        'custom_tab' =>  array(
            'title' => __( "Short description", "woocommerce" ),
            'priority' => 12,
            'callback' => 'short_description_tab_content'
        )
    );
    return array_merge( $custom_tab, $tabs );
}

// Custom product tab content
function short_description_tab_content() {
    global $post, $product;

    $short_description = apply_filters( 'woocommerce_short_description', $post->post_excerpt );

    if ( ! $short_description ) {
        return;
    }

    echo '<div class="woocommerce-product-details__short-description">' . $short_description . '</div>'; // WPCS: XSS ok.
}

How to use shortcodes inside Woocommerce Conditional Product Tabs?

Pay attention though, that you can also use shortcodes inside your custom tabs. For example, I am using Fluent forms for enquiry form tab and Reusable Blocks Extended plugin for showing Gutenberg blocks inside Shipping information tab.

So, if you don’t need to use shortcodes in your tabs then delete this part in the coe above.

echo do_shortcode('[fluentform id="1"]');

Video: How to create, remove, rename and reorder Woocommerce product tabs?

Here are some of my favorite Wordpress tools

Thank you for reading this article. I hope you found it helpful as you build your own websites and e-commerce sites. Here are some tools I use as a Wordpress developer and enthusiast that I hope you’ll also find helpful.

These are affiliate links, so if you do decide to use any of them, I’ll earn a commission and this helps me create these tutorials and make Youtube videos. But in all honesty, these are the exact tools that I use and recommend to everyone, even my friends and family.

Themes: For the last couple of years I have two go-to themes which I use for every kind of projects. Those two themes are Blocksy theme and Kadence Theme. On this site and my Youtube channel you’ll see a lot of tutorials I have made about them. If you would like to get a 10% discount for both of them then:

Contact forms: There are hundreds of contact forms out there but Fluent Forms is the one I like the most. If you need a 20% discount then use this link (save 20% coupon is WPSH20).

Gutenberg add-ons: If I need a good Gutenberg blocks add-on then Kadence Blocks is the one I have used the most. You’ll get 10% discount with the coupon SIMPLEHACKS here.

Website migration: While building a website you probably need a good plugin that can help you with the migration, backups, restoration and staging sites. Well, WpVivid is the one I have used for the last couple of years. If you use this link along with the WPSH20 coupon you’ll get 20% discount.

Woocommerce extensions: There are a bunch of Woocommerce extensions that I really like but the one that stands really out is Advanced Dynamic Pricing. Once again, you’ll get a 20% discount if you use this link here (save 20% coupon is WPSH20)

Web Hosting: For getting started, I really like A2 Hosting. They have the dedicated and fast Wordpress hostinh and support has also been fast and responsive. If you’re more tech savvy and want to have a really fast managed cloud hosting then I recommend Cloudways. (Btw, this site is hosted in Cloudways.)

To see all my of most up-to-date recommendations, check out this resource that I made for you!

Do you want to thank me and buy me a beer?

Every donation is entirely welcome but NEVER required. Enjoy my work for free but if you would like to thank me and buy me a beer or two then you can use this form here below.

Choose amount

Best selling plugins

Default image
Janek T.
I am a Wordpress enthusiast who has been making websites since 2011. In this site I am offering simple to follow tips on how to use Wordpress and Woocommerce. If you want to be the first to be notified about the new tutorials then please subscribe to my Youtube channel here Follow me in Twitter here
Articles: 72