Move Reviews tab before the description on WooCommerce product pages

Show ‘reviews’ tab as the first tab among ‘description’ and ‘additional information’ tabs on a WooCommerce website to give more visibility to reviews. We have already seen the different approach for more reviews visibility by showing reviews separately out of the tabs section. Now, let move the ‘reviews’ tab position in the tabs section on WooCommerce product pages.

Preview: Before and After

WooCommerce move reviews tab

PHP Snippets: Move Reviews Tab

In the WordPress Dashboard, go to Appearance > Theme Editor and open the functions.php file. Add the following code at the end.

The Code Explanation

You can filter (add/edit/delete) the existing tabs with the woocommerce_product_tabs filter. First, I am creating a new tabs array variable and then checking if reviews form is open for a product. If reviews form is open, then we are re-positioning specific tabs.

  • 14-15: Re-assigning the existing reviews tab at first place in new tabs array and removing the existing reviews tab from the old tabs array.
  • 17-20: If a product has Description tab, we assign the old description tabs at 2nd place in the new tabs array and removing it from the old tabs array.
  • 22-25: If a product has Additional Information tab, we assign this tab the 3rd place in the new tabs array and remove it from the old tabs array.
  • 27: Merging two arrays and creating a new array.
  • 30: Returning array for the display.

Share this Tutorial

Leave a Comment