With regards to Commerce 2 product variation types.

When 'Generate variation titles based on attribute values' is NOT enabled and where the variation type does NOT have named attributes, the resulting variation is known only as [Variation Title]. This usually creates an incomplete description when shown in the cart and order views.

So. When 'Generate variation titles based on attribute values' is NOT enabled, make the generated variation name [Product Name] - [Variation Title]

Comments

MrPaulDriver created an issue. See original summary.

mglaman’s picture

Status: Active » Postponed (maintainer needs more info)

So. When 'Generate variation titles based on attribute values' is NOT enabled, make the generated variation name [Product Name] - [Variation Title]

But the title isn't generated? You are manually setting it. I'm not sure I follow.

Is the problem here the fact core's token support is lacking, and we do not have token as a dependency - thus hindering "Here, override the normal generation logic with these token based values"

mglaman’s picture

I *think* this would be solved by #2923854: Start depending on Token and allowing a custom input for changing the way a variation's title is generated.

MrPaulDriver’s picture

I don't think this is a token issue, because the information required already belongs to commerce. Please excuse my of use of square brackets if this has confused things.

To quote from issue/2923854 which you reference;

I could see this (token) being used for: Customizing the variation title generation (currently hardcoded to Product Name - Attributes)

I am simply asking for hardcoding of Product Name - Variation Title; to be displayed where 'Generate variation titles based on attribute values' is NOT enabled.

I ask this because Commerce already requires manual completion of a Variation Title field, if variation title generation is not enabled. But the full product title does not find it's way to the cart and order views.

Please allow me the following example.

Product Name: My Unique Book Title
Variation One: September 2014 Edition
Variation Two: October 2017 Edition

Assuming that an 'order item type' is configured to display the purchased entity as 'product vatiation title' AND if the editor does not want to create attributes for their unique product, the purchased entity will display only as September 2014 Edition in the cart and order views, with no mention of the parent product title. It should of course display as 'My Unique Book Title - September 2014 Edition'.

In situations where a product's variations are unique to the product itself, it is unreasonable to require the creation of an attribute set, in addition to, and before, the variations are created. The variation title should be enough and I have heard Ryan describe this as a 'classic variation'

This UX has flaws and the strict workflow is somewhat the same as requiring an editor to create a product before creating a product display.

This is my first outing with Commerce 2, and I have spent several days trying to resolve this matter; thinking it must be a bug, only to realise that this feature actually works as intended. Please consider improving it.

mglaman’s picture

So, without variation title generation you'd still like the variation label to include the product's title - not just the variation's title. Without having to update views and such to include the product title.

mglaman’s picture

Status: Postponed (maintainer needs more info) » Active

Moving to active. Would a "Prepend product title" type setting resolve this? It again comes to the whole generated title item and providing options on what exactly a generated title is.

MrPaulDriver’s picture

Yes and Yes. And yes please.

mglaman’s picture

Thanks for helping clarify the request. Would it be best to:

  • If generate title is enabled, but there are no attributes on the variation, expose the title field. Prepend product title to variation title
  • Generate title "strategies": Current option (attributes), custom title (because you may have attributes, still but want control of title), "Custom"
    using token/twig replacements.

Thoughts? I feel option #1 would be best, but I'm assuming you may be using attributes?

MrPaulDriver’s picture

Thank you for considering the request.

Option one would completely satisfy the use case of a variation with no attributes. I also think commerce should work like this out of the box.

Option two, sounds like a separate module, similar to Automatic Entity Label.

MrPaulDriver’s picture

But I'm assuming you may be using attributes?

To be clear.

- If using attributes, the variation label should be 'Product Title - Attribute Title'

- If NOT using attributes, the variation label should be 'Product Title - Variation Title'

This methodology fits with 'order item types', where the purchased entity widget can be configured to display 'product attribute title' or 'product variation title'.

If you wanted to nail the UX, each of these variation label types would be automatically paired with a compatible 'order item type'.

Suggest that custom labelling of variations should handled by contrib, or a combination of token and twig.

mglaman’s picture

Cool! I wasn't sure if you were using attributes and still wanted it customized. I think this is a far enough thing to work on. My time is currently tied up in roadmap work, but I'll keep it as a good issue for people to work on.

MrPaulDriver’s picture

Thank you. Please let me know if you need anything testing.

Alexandre360’s picture

+1, by waiting a fix to this, how can you get the product title in commerce-product-variation.html.twig ?

geek-merlin’s picture

bbuchert’s picture

This might also be helpful if you want certain attributes excluded form the variation title.

Not sure if what I did is not a good idea, but I added an attribute processing time into the product variation which I would not want inside the variation title. Being able to set the variation titles via tokens. Would give a lot of flexibillity.

bojanz’s picture

Status: Active » Closed (duplicate)

Let's continue in #3083745: Rework product variation title handling, which tries to write down all of the intersecting use cases.