WooCommerce product page tabs display important information. Sometimes, you may want to change their titles to suit your needs.
For example, instead of “Description,” you might want to say “Product Details.” Let’s see how you can easily change product page tab titles with some little code.
Table of Contents
Code Snippet to Change the Product Page Tab Titles
This code modifies the default tab names on WooCommerce product pages. Here’s what it does:
- Changes the “Description” tab to “Product Details.”
- Changes the “Reviews” tab to “Customer Reviews.”
- Changes the “Additional Information” tab to “More Info.”
By hooking into woocommerce_product_tabs
, the code allows you to customize the titles of these tabs to fit your needs.
Copy the code and add it to your functions.php
file. Replace the names in the code with what you want.
// Change default product tab names
add_filter('woocommerce_product_tabs', 'custom_woocommerce_product_tabs', 98);
function custom_woocommerce_product_tabs($tabs) {
// Change the "Description" tab name
if (isset($tabs['description'])) {
$tabs['description']['title'] = 'Product Details'; // Change to your desired name
}
// Change the "Reviews" tab name
if (isset($tabs['reviews'])) {
$tabs['reviews']['title'] = 'Customer Reviews'; // Change to your desired name
}
// Change the "Additional Information" tab name
if (isset($tabs['additional_information'])) {
$tabs['additional_information']['title'] = 'More Info'; // Change to your desired name
}
return $tabs;
}
How to Add the Code Snippet
You should add the code snippet to the functions.php
file in your child theme. If you don’t have a child theme, read this guide on How to Create a Child Theme.
Once you have the child theme, follow these steps:
- Go to your WordPress dashboard.
- Hover over Appearance and click on Theme File Editor.
- On the right side, find
functions.php
andstyle.css
- Click on file names to add the code.
Paste the code and click on Update File.
Go to your product page and refresh it. You should see the new tab names displayed.
Related articles: How to Add Custom Tabs to Single Product Page in WooCommerce (Free)
If you have any questions, feel free to leave a comment below. I will try my best to answer.