How to change priority of tabs on product page in woocommerce? | themelocation

How to change priority of tabs on product page in Woocommerce?

In this tutorial we’ll learn how to change the priority of tabs on product page in woocommerce.
We can achieve this by using one of woocommerce’s default filters.
Here is our default single product screen.

woocommerce

As you can see from here, description tab is being displayed before reviews tab.

Now let’s say we want to display reviews tab before description tab.

To do this add the following lines of code at the end of your theme’s functions.php file.

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

function woo_reorder_tabs( $tabs ) {

   $tabs['reviews']['priority'] = 5;           // Reviews first

   $tabs['description']['priority'] = 10;     // Description second

   return $tabs;

}

 

You can access functions.php file here:

woocommerce

Save the file by clicking on update file button after placing the above code in file.

Now go to / refresh single product page and you’ll see product tabs prioritized accordingly.

woocommerce

In this way you can prioritize other tabs as well if any.

CHEERS J

No comments yet.

Leave a Reply