Reputation: 447
I'm trying to find my way to move the tab for additional information from WooCommerce, from the first position to the one before the reviews. At the moment the Additional information tab is the first tab, and so far, the bes i found is how to make it disappear with the following code:
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;
}
And I can not manage to think a way of accomplishing what i'm doing, as my logic tells me that in order to tell the tab to be moved to the one before the last tab (the reviews tab) there must be some kind of order such as first, second, third, etc...
Upvotes: 2
Views: 1915
Reputation: 447
Got it working that piece of code, but not quite sure of why does it actually works, so it would be good if some expert can explain. But here is the piece of code I used in my personal case:
add_filter( 'woocommerce_product_tabs', 'reordered_tabs', 98 );
function reordered_tabs( $tabs ) {
$tabs['additional_information']['priority'] = 10;
$tabs['detailed-information']['priority'] = 5;
$tabs['reviews']['priority'] = 15;
return $tabs;
}
The additional_information and the detailed-information, i took them from my web by inspecting the element and inputting the value of the
<a href="#tab-additional_information" data-toggle="tab">Additional Information</a>
I just removed the "#tab-" and it worked.
Hope someone can clarify a bit more and it can help someone else.
Upvotes: 1