Change Product Tabs Order

Let’s figure out how to set your custom order for product tabs on single product pages and how to select a tab you want to be opened by default.

/1 comment

The good news is that we do not have to deal with sorting arrays like we did with my account menu or admin columns for example.

Each of the tabs has a priority parameter:

We can easily display the “Reviews” tab first by changing this parameter:

add_filter( 'woocommerce_product_tabs', 'misha_change_tabs_order' );
 
function misha_change_tabs_order( $tabs ) {
 
	$tabs['reviews']['priority'] = 5;
 
	return $tabs;
 
}

As you can see on the screenshot below, this not only changes the tab order, but also changes which tab is opened by default which is cool.

Change product tabs order in WooCommerce
“Product size” is the “Additional information” tab actually, I just renamed it in the previous tutorial.

One more thing –  that hook priority in this case must be 98 or below! It is because the array sorting function is also connected to this hook and has 99 priority.

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

One more time – if you set it 99 or more than 99, the code will have no effect at all!

More about Product Tabs

Misha Rudrastyh

Misha Rudrastyh

I love WordPress, WooCommerce and Gutenberg so much. 10 yrs of experience.

Need some custom developer help? Let me know

Follow Misha

Need some help with WooCommerce?

If you need some professional developer help, I will be happy to assist you.

Contact me Who I am?

Comments — 1

Leave a comment

php js HTML CSS Code

I will only use your personal information to contact you. Privacy Policy