• Resolved Cezar Ayran

    (@ayrancd)


    Anyone know a good way to replace the tags label on WooCommerce product page without having to add a translate plugin?

    We’d like to call it Brands instead of Tags on the product page.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Copy
    wp-content/plugins/woocommerce/templates/single-product/meta.php
    to
    wp-content/themes/your-child-theme-name/woocommerce/single-product/meta.php
    and edit Tag: and Tags: on line 36
    you will need to update the template when WooCommerce update the master from time to time.

    However, it will be easier to use a translate plugin:
    https://wordpress.org/plugins/say-what/
    Set up a new text change:

    Original string
    Tag:
    (must be exact, no space at the end)

    Domain
    woocommerce

    Context
    (leave blank)

    Replacement string
    Brand:

    and another for Tags:

    Thread Starter Cezar Ayran

    (@ayrancd)

    This is my solution:

    //loads brands on product page
    function loadTagsOnProductPage(){
        $child = get_terms( array( 'taxonomy' => 'product_tag',  'term_id' => get_the_id() ) );
        if(count($child) > 0){
            foreach($child as $cat){
                $content = "<a href='".get_term_link($cat->term_id)."'>".$cat->name."</a>";
            }
        }else{
            $content = "Missing brand";
        }
        return $content;
    }
    add_shortcode('tags_products', 'loadTagsOnProductPage');

    Hi @ayrancd

    Thanks for sharing your solution with the community!

    Cheers!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Replace tags label’ is closed to new replies.