By default, the first tab is the tab which is opened when the product page is loaded. That means, out of the box, WooCommerce will display the product description as open as this is the first tab. However, if we change the order of the tabs, so that Reviews is first for example, Reviews will show as open. By default, there are three product tabs providing they are populated and enabled which display in the following order: Description, Additional Information, and Reviews. This guide shows you how you can change the order of tabs, and therefore the default opened tab, by changing the priority parameter:
- Description Tab has a priority parameter of 10
- Additional Information Tab has a priority parameter of 20
- Reviews Tab has a priority parameter of 30
So, to change the order, we simply change the priority parameters as necessary. Specifically, this guide shows the Reviews Tab first, the Description Tab second, and the Additional Information Tab last.
/**
* Snippet Name: WooCommerce Change Order Of Product Tabs
* Snippet Author: ecommercehints.com
*/
add_filter( 'woocommerce_product_tabs', 'ecommercehints_change_product_tabs_order' );
function ecommercehints_change_product_tabs_order($tabs) {
$tabs['reviews']['priority'] = 10;
$tabs['additional_information']['priority'] = 20;
$tabs['description']['priority'] = 30;
return $tabs;
}