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

Share:

Leave a Reply