Skip to content

[5.x]: Variant title is updated unintentionally #4126

@ryansupercool

Description

@ryansupercool

What happened?

Description

Commerce 5.4.5 fixed an issue where variants title weren't updated when the owner product was saved and the variant title format contained references to the owner product. This was implemented via #4095.

The feature appears to be too eager as it updates the variants immeditely i.e when editing the product with unsaved changes. The result it that the variant title is updated in real time. This is a problem if an editor:

  • Accidently edits the product title
  • Gets halfway through updating a title
  • Is drafting product changes

The result in all cases is that the variant title is updated.

Steps to reproduce

  1. Set the variant title format to contain {owner} - {sku}
  2. Edit a product with variants

Expected behavior

Variant title is only updated when the canoncial product is saved.

Actual behavior

Variant title is updated with anytime the product is saved.


We noticed this behaviour when testing Commerce as we are also implementing nested elements that have part/child dependencies for field values. We not sure what the ideal implementation fix here is perhaps drafts of nested elements should be created and then published along with the owner. How should previewing work? Would you see the updated variant titles when live previewing a product?

Craft CMS version

5.8.17

Craft Commerce version

5.4.6

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions