Do you want to change the order of the WooCommerce tabs on the single product page?
By default, WooCommerce adds three tabs to display related product data. This includes a detailed description of the product, user reviews, and additional information (if any).
You may want to display these data tabs in a different order on the WooCommerce single page.
You can use the below code to reorder the data tabs on the single product page in WooCommerce.
/**
* Reorder product data tabs
*/
function maverick_reorder_woocommerce_single_product_tabs( $tabs ) {
// Set Reviews Tab first
$tabs['reviews']['priority'] = 5;
// Set Description Tab second
$tabs['description']['priority'] = 10;
// Set Additional information Tab third
$tabs['additional_information']['priority'] = 15;
return $tabs;
}
add_filter( 'woocommerce_product_tabs', 'maverick_reorder_woocommerce_single_product_tabs', 98 );
5, 10, and 15 are the priorities assigned to WooCommerce data tabs. If you wish you change the order, you can interchange their priorities.
For example, if I need additional information first, followed by reviews, followed by the description tab. The code will be revised as the below code.
/**
* Reorder product data tabs
*/
function maverick_reorder_woocommerce_single_product_tabs( $tabs ) {
// Set Reviews Tab first
$tabs['reviews']['priority'] = 10;
// Set Description Tab second
$tabs['description']['priority'] = 15;
// Set Additional information Tab third
$tabs['additional_information']['priority'] = 5;
return $tabs;
}
add_filter( 'woocommerce_product_tabs', 'maverick_reorder_woocommerce_single_product_tabs', 98 );