• Hi,

    My shop’s idea is that every product has few colors and when user change color – it also changes product name.
    For example, I have product T-Shirt and few color variations. When user choise black color – product name is “Black Company T-Shirt”, when white color – product name is “Company T-Shirt in white variation”.

    My single solution is to make one more attribute. This attribute will print somewhere, but will be hidden from user. Next I get this attribute (variation name) and force add it with javascript in DOM instead of product name, but I’m not sure that it’s best solution. Can you help me?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bublick

    (@bublick)

    Ok,

    I did it. Not best way, may be, but anyway. There is need to add variation attribute. We can do this via hooks to woocommerce_product_after_variable_attributes and woocommerce_save_product_variation.

    Next, on single product is need to remove product title and added

    <h1 itemprop="name" class="product_title entry-title woocommerce-variation-name">
            {{{ data.variation.text_field }}}
         </h1>

    in variation.php template. Not best for SEO, but if we use default variative attribute it’s better.

    Next. There is need to make changes in title in quick-cart page.
    Next on review-order.php

    No need to make this via js, cause variation part loads not fastest, so template in variation.php is best and after this, on cart overview pages we can get this new titles from meta.

    If you have question and I can help you – ask me.

    • This reply was modified 9 years, 2 months ago by bublick.
    • This reply was modified 9 years, 2 months ago by bublick.
    yashshah1800

    (@yashshah1800)

    Hi!
    I want to append the color name to the product title on the product details page.
    I have color variations of a product.
    Thus a product has title, color name

    When user selects yellow, I would like the product title to be title name, yellow
    How do I achieve the same. Thank you in advance.

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

The topic ‘Set product name for each variation’ is closed to new replies.