Home » WooCommerce: Rename “Tags” Label @ Single Product Page

WooCommerce: Rename “Tags” Label @ Single Product Page

by adminkys

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 tutoraspire.com FREE
 * @author        Tutor Aspire
 * @compatible    WC 5
 * @donate $9     https://www.tutoraspire.com
 */

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

function tutoraspire_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;
}

You may also like