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('');
	}
  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('');

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

Here are some of my favorite WordPress tools

Thanks for reading this article! I hope it's been useful as you work on your own websites and e-commerce sites. I wanted to share some tools I use as a WordPress developer, and I think you'll find them helpful too.

Just so you know, these are affiliate links. If you decide to use any of them, I'll earn a commission. This helps me create tutorials and YouTube videos. But honestly, I genuinely use and recommend these tools to my friends and family as well. Your support keeps me creating content that benefits everyone.

Themes: Over the past few years, I've consistently relied on two primary themes for all sorts of projects: the Blocksy theme and the Kadence Theme. If you explore this website and my YouTube channel, you'll come across numerous tutorials that delve into these themes. If you're interested in obtaining a 10% discount for both of these themes, then:

Code Snippets Manager: WPCodeBox allows you to add code snippets to your site. Not only that, but it also provides you with the capability to construct and oversee your WordPress Code Snippets library right in the cloud. You can grab it with the 20% discount here (SAVE 20% Coupon: WPSH20).

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 a 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 a 20% discount.

Woocommerce extensions: There are a bunch of Woocommerce extensions that I like but the one that stands 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: If you would like to have a really fast and easy-to-use managed cloud hosting, then I recommend Verpex Hosting (see my review here). By the way, this site is hosted in Verpex.)

To see all my 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.

Donation Form (#2)

Janek T.
Janek T.

Improve this text: {CLIPBOARD}

- I have been passionate about Wordpress since 2011, creating websites and sharing valuable tips on using Wordpress and Woocommerce on my site.
- Be the first to receive notifications about new tutorials by subscribing to my Youtube channel .
- Follow me on Twitter here

Articles: 106