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 “tag” WooCommerce Taxonomy


/**
 * @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) {

if ( is_product() ) {
// This will only trigger on the single product page
$translated = str_ireplace('tag', 'brand', $translated);
}

return $translated;
}

Where to add this snippet?

You can place PHP snippets at the bottom of your child theme functions.php file (before "?>" if you have it). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my free video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7+.

If you think this code saved you time & money, please join other Business Bloomer supporters and avail of 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce Customization?

Check out these free video tutorials. You can start learning how to customize WooCommerce without unnecessary plugins. Watch me code and learn by example!

  • how-to-edit-woocommerce-with-php-snippets
  • woocommerce-hooks-add_action-list-visual
  • woocommerce-customize-single-product-page-PHP

Rodolfo Melogli

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as a 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.

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

  1. 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 🙂

  2. 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

  3. 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 🙂

  4. 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!

  5. 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 🙂

  6. 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 🙂

  7. 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? Support? Leave your Comment Now!
_____

If you are writing code, please wrap it between: [php]code_here[/php]. Failure to complying with this (as well as going off topic) will result in comment deletion. You should expect a reply in about a week - this is a popular blog but I need to get paid work done first. Please consider joining #BloomerArmada to ask me 1-to-1 WooCommerce questions. Thank you :)

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