woothemes-ninja3On the 6th of March (I think) the lovely guys at WooThemes graced us with a lovely new version of their fantastic WooCommerce plugin. They changed a lot of things, most of which I have yet to absorb. A couple of notable things though caught my eye. You may or may not be aware that I have written a few tutorials concerning the WooCommerce tab system. Adding new ones and, of course, removing the reviews tab. Since 2.0 the product tab API has been updated and is now somewhat slightly more elegant.

We now need to work around a single WordPress filter called ‘woocommerce_product_tabs’. You can add your own functions to this which receive a ‘tab’ array which you can manipulate and then return back. It’s quite important that when manipulating this you either don’t use the ‘priority’ setting of the filter system or, if you need to use it for some reason, make sure to use a priority less than 99. The reason for this is that you can now control where your tab shows in the list by adding another ‘priority’ setting.

For clarity the latter priority system lives in the ‘tabs’ array which controls the order of the tab. By default the Description tab is set to 10 and the Reviews tab is set to 20. Just slot yours in to suit. To avoid confusion in my code below I will explain both priority systems so that you don’t use one of them and use the other properly.

So.. removing the WooCommerce reviews tab is accomplished in 2.0 as follows:

add_filter( 'woocommerce_product_tabs', 'sb_woo_remove_reviews_tab', 98);
function sb_woo_remove_reviews_tab($tabs) {


 return $tabs;

You can rename the reviews tab (or any tab for that matter) using the following code making sure to substitute the ‘reviews’ bit for the index of the correct tab.

add_filter( 'woocommerce_product_tabs', 'sb_woo_rename_reviews_tab', 98);
function sb_woo_rename_reviews_tab($tabs) {

 $tabs['reviews']['title'] = 'Sausages';

 return $tabs;

So you can now also add new tabs to the new WooCommerce 2.0 system as follows:

add_filter( 'woocommerce_product_tabs', 'sb_woo_new_test_tab');
function sb_woo_new_test_tab_content() {
 echo '<h2>Hello World</h2>';

 echo '<p>You look hungry. Have some Sausages!</p>';

function sb_woo_new_test_tab($tabs) {
 $tabs['test_tab'] = array(
 'title' => __( 'Test Sausages', 'woocommerce' ),
 'priority' => 50,
 'callback' => 'sb_woo_new_test_tab_content'

 return $tabs;

I would hope this is self explanatory but I will be more than happy to explain any of this code if it isn’t clear. I should point out something really important here. The priority system..

When removing the reviews tab (or any tab) you should use a priority of 98. This means that it will be processed just before the array is sorted and you will guarantee that the code runs after anyone else’s system adding their own reviews tab (or any other tab) as follows:

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

Note however that when adding a new tab we don’t need to/shouldn’t assign a priority as the WooCommerce 2.0 tab system actually orders the array by the tab priority (that which I set to 50 in the above example) anyway. So we use the following syntax omitting the priority setting:

add_filter( 'woocommerce_product_tabs', 'sb_woo_new_test_tab');

If you would like to know anything else about the WooCommerce 2.0+ API then please ask via the comments or submit one of the many contact forms on this site.

I should add that I have written many tutorials in and around the tab system in previous months and if you have yet to upgrade to 2.0 then you will need my original blog post on the subject.


Some people have asked how to rearrange tabs. This is accomplished as follows:

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

This will move the reviews tab to the start (unless anything has a priority lower than 5). It’s best to leave a gap instead of using 1 or 0 because you might want to put something before this later on and it saves you digging around for the code.

If you want to move your tabs around then simply use the following code to get a list of your tab names:

add_filter( 'woocommerce_product_tabs', 'sb_woo_debug_tabs', 98);
function sb_woo_debug_tabs($tabs) {

echo '<pre>';
echo '</pre>';

return $tabs;

This will output an array of data to the screen. It should be fairly obvious which names you need to use. Once you have seen the output then remove the code and use the rearrange WooCommerce tabs example above  to do it.


Some people have been reporting the following error or similar for their WooCommerce sites:

Warning: uasort() [function.uasort]: The argument should be an array in …/wp-content/plugins/woocommerce/woocommerce-template.php on line 791

I want to reassure you that this is NOTHING to worry about except a bit of error catching needed to be added to the next version of WooCommerce if it’s not there already. Basically it happens then the tabs have been removed leaving nothing for the sorting function to parse. There is nothing we can do about this so it’s best to use the following code to sort it out.

Edit your theme functions.php file to add

<?php error_reporting(E_ERROR); ?>

This causes the system to only report errors when they are fatal (ie they will interrupt the page load) and not when small warnings and notices have been sound as with removing the last tab from the list. It should solve a lot of problems..

A donate button!

Be the first to hear about new products/updates!

This is a mailing list for those people interested in being told when we release a new product (Divi plugin or Theme).

We shall also use this list to let you know about product updates and releases.

You have Successfully Subscribed!