WooCommerce: Rename “Tags” Label @ Single Product Page

A #CustomizeWoo student reached out for premium support in regard to “WooCommerce taxonomies”. The question was: How do I change the label “tag” into something else, for example “brand”? Well, this is how it’s done!

Please note that this does not change the “tag” permalinks (URL, slug, etc), but only the “Tags” label on the frontend, and only on the Single Product Page.

WooCommerce: rename “tags” into something else

PHP Snippet: Rename “Tags:” @ WooCommerce Single Product Page

/**
 * @snippet       Rename "Tags" into "Brands" @ WC Single Product Page
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WC 5
 * @community     https://businessbloomer.com/club/
 */

add_filter( 'ngettext', 'bbloomer_translate_tag_taxonomy', 9999, 5 );

function bbloomer_translate_tag_taxonomy( $translation, $single, $plural, $number, $domain ) {
	if ( is_product() && 'woocommerce' === $domain ) {
		// This will only trigger on the WooCommerce single product page
		$translation = ( 1 === $number ) ? str_ireplace( 'Tag:', 'Brand:', $translation ) : str_ireplace( 'Tags:', 'Brands:', $translation );
	}
	return $translation;
}

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

  • WooCommerce Visual Hook Guide: Single Product Page
    Here’s a visual hook guide for the WooCommerce Single Product Page. This is part of my “Visual Hook Guide Series“, through which you can find WooCommerce hooks quickly and easily by seeing their actual locations (and you can copy/paste). If you like this guide and it’s helpful to you, let me know in the comments! […]
  • WooCommerce: Disable Variable Product Price Range $$$-$$$
    You may want to disable the WooCommerce variable product price range which usually looks like $100-$999 when variations have different prices (min $100 and max $999 in this case). With this snippet you will be able to hide the highest price, and add a “From: ” prefix in front of the minimum price. At the […]
  • WooCommerce: Hide Price & Add to Cart for Logged Out Users
    You may want to force users to login in order to see prices and add products to cart. That means you must hide add to cart buttons and prices on the Shop and Single Product pages when a user is logged out. All you need is pasting the following code in your functions.php (please note: […]
  • WooCommerce: How to Translate / Rename Any String
    There are times you don’t want to translate the whole installation of WooCommerce just for renaming one short string. There are times you need to rename a label or a little thing and don’t feel like installing a bloated translation plugin. It doesn’t matter whether you want to rename a string in the original language […]
  • WooCommerce: Add Custom Field to Product Variations
    Adding and displaying custom fields on WooCommerce products is quite simple. For example, you can add a “RRP/MSRP” field to a product, or maybe use ACF and display its value on the single product page. Easy, yes. Unfortunately, the above only applies to “simple” products without variations (or the parent product if it’s a variable […]

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

31 thoughts on “WooCommerce: Rename “Tags” Label @ Single Product Page

  1. Thanks for the tip. I tried but it is not work for my site too.
    My site’s default language is Simplified Chinese. i add the code to my functions.php, i try to chang tag(标签)to special(特色),after add it is the same, nothing is change

      1. thx,i just change woocommerce-zh_CN.po translate character to fix the problem ,but still thx again!

  2. Thanks for the tip. I tried but not work for my case.

    My site’s default language is Traditional Chinese. If I add below script where XXXX is the string in my default language
    $translated = str_ireplace(‘tag’, ‘XXXX’, $translated);

    then I have two problems:

    1. From the product page, it shows XXXXs: ….., there is no singular and plural form to the string in Traditional Chinese.

    2. English is my second language, I don’t know how to translate XXXX back to English, I can’t find the string from WPML String Translation because it has not to be registered.

    , then the display from product page

    1. Tried the latest version already?

  3. How to get this done for Product Brand?

    1. Hi Ashwini, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  4. Thanks, everything worked for me. Translated the product tag into English and French : tag and Étiquettes to “condition” (for a vinyl shop). Did this in the main theme function.php but will have to learn how to implement this to a child theme. Site will be online soon.

    1. Nice!

      1. No. Its not working and im getting 503 error.

        1. Hi, Im sorry, the code is running fine. Only after i read other comments, where we could not use code snippet plugins.

          Thanks. keep the good work

          1. Great!

  5. Hello, I am trying to change the “Category” name to “Personality” on the single product page. I used the same code you provided above, but swapped out “Tag” for “Category” and “Brand” to “Personality” but nothing has happened.

    Should the same code work? Or should;d I try something else?

    1. Hi Evan, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  6. Re: “Oh no! I just copied and pasted your code into my Snippets Plugin and it took down the site. Now I have a 500 error and can’t get back in to even remove it. Can you help?”

    I too had issues with this snippet (I got memory exhausted errors). I have tried SEVERAL suggested code sippets trying to find ONE which allowed me to change the “SKU” text on the single product page to read “Model #”. I got this one to work using, (using the Code Snippets plugin) but it required a small modification to get it to work.

    Basically I removed the “if” condition and used the following code instead:

    /*Begin Code*/
    /**
    * @snippet Rename “Tags” into “Brands” @ Single Product Page – WooCommerce
    * @how-to Get CustomizeWoo.com FREE
    * @sourcecode https://businessbloomer.com/?p=21598
    * @author Rodolfo Melogli
    * @compatible WC 3.4.3
    */

    add_filter(‘gettext’, ‘bbloomer_translate_tag_taxonomy’);
    add_filter( ‘ngettext’, ‘bbloomer_translate_tag_taxonomy’ );

    function bbloomer_translate_tag_taxonomy($translated) {

    $translated = str_ireplace(‘SKU’, ‘Model #’, $translated);

    return $translated;
    }
    /*EndCode*/

    Once I removed the “if” statement the error went away and “SKU” was relabeled to “Model #” as I wanted.

    For anyone using the Code Snippets plugin (or one like it, you will need to inactivate the offending snippet by deactivating it at the database level. (basically find the row in your snippets table with the offending snippet and set it to inactive should bring your site back up)

    “Using Code Snippets is not ideal because you can’t access the code directly and “switch it off” – I recommend you look into creating a child theme instead. Anyway, via FTP, go to the plugins folder and rename the Code Snippets plugin folder temporarily – your site will come back up. Let me know”

    FYI, I AM using Code Snippets with a child theme because it allows me to manage ALL of my code snippets in a VERY easy to use interface. I used to create mini plugins with my snippets so that I could easily turn them on or off as needed for debugging or retiring snippets. Now without without requiring FTP or the theme editing, I can turn code snippets on and off with the Code Snippets plugin. The plugin also does not limit me to JUST PHP code snippets, I can also use this for javascript and CSS snippets as well. It also gives me options for organizing my snippets that I didn’t quite have when truning them into mini plugins.

    1. Thanks for your feedback 🙂

  7. Oh no! I just copied and pasted your code into my Snippets Plugin and it took down the site. Now I have a 500 error and can’t get back in to even remove it. Can you help?

    1. Sorry to hear that Deby, my snippet works so you have some other sort of issue. Using Code Snippets is not ideal because you can’t access the code directly and “switch it off” – I recommend you look into creating a child theme instead. Anyway, via FTP, go to the plugins folder and rename the Code Snippets plugin folder temporarily – your site will come back up. Let me know

  8. Hey Rodolfo, me again, it’s working to a point… The client wishes to have the word “For” instead of “Tags” but there is an ‘s’ added so now it says “Fors”… any thoughts on that?

    1. Hello Rochelle – thanks so much for your comment! Yes – try to translate “tags” and not “tag” – that will work 🙂

  9. Hooray!

    A few days of hunting for something that would work for me and this did the job. I needed to change the category taxonomy name and so replaced “tag” with “category” and viola.

    Thank you very much!

    1. Excellent 🙂

      1. I tried to replace tag with category and it did not work. Any ideas why? Thank you for your great website!

        add_filter('gettext', 'bbloomer_translate_category_taxonomy');
        add_filter( 'ngettext', 'bbloomer_translate_category_taxonomy' );
         
        function bbloomer_translate_category_taxonomy($translated) {
         
        if ( is_product() ) {
        // This will only trigger on the single product page
        $translated = str_ireplace('category', 'Collection', $translated);
        }
         
        return $translated;
        }
        1. Try with “Category: ” instead and let me know!

  10. Enjoying your videos and WooCommerce modification and a lot of it has worked out great! Not sure why this doesn’t work; tried on two (development) sites on two different servers. The only way I’ve had success is by copying meta.php to the child theme – the totally ugly way to do it. The parent theme didn’t have this file and I also tried using twenty-seventeen theme, but still no luck. Added your the code to the child theme functions.php. Am using Avada and notice they have their own set of WooCommerce hooks. https://theme-fusion.com/documentation/avada/special-features/remove-woocommerce-overrides-avada/ but nothing for changing the ‘Tag’.

    1. Hey Rochelle, thanks so much for your comment! I’ve revised the snippet, give it a go 🙂

  11. I still can’t change it pls. I want to rename it from /tag/ to /artist/

    1. Hey Richard, thanks for your comment! I think this renames the label and not the URL/slug. Sorry 🙂

  12. Thanks! works great at my site. I was trying to translate it to spanish “Brand” (marca), and with this snippet I have done it in just a minute.
    Cheers
    Marius

    1. Brilliant 🙂 Thank you Marius!

Questions? Feedback? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

Your email address will not be published. Required fields are marked *