Skip to content

Fix SKU format not resolving {id} for new variants - #4354

Merged
lukeholder merged 3 commits into
5.xfrom
bugfix/variant-sku-format-id
Sep 2, 2026
Merged

Fix SKU format not resolving {id} for new variants#4354
lukeholder merged 3 commits into
5.xfrom
bugfix/variant-sku-format-id

Conversation

@lukeholder

@lukeholder lukeholder commented Sep 1, 2026

Copy link
Copy Markdown
Member

Summary

  • skuFormat values containing {id} produced a truncated SKU (e.g. SKU-4012-) for new variants, because updateSku() runs before the variant has an ID.
  • updateTitle() got the same fix for variantTitleFormat in [5.7] Update variant title after record is saved #4308, via afterAssignedId(). This applies the same idea to SKUs.

updateSku() ran in beforeValidate()/beforeSave(), before the variant
had an ID, so a skuFormat referencing {id} produced a truncated SKU
on create. Mirrors the existing afterAssignedId() fix for title
formats (#4308), but regenerates the SKU since updateSku() only
fills in blank SKUs.
@lukeholder
lukeholder requested a review from a team as a code owner September 1, 2026 01:50

@nfourtythree nfourtythree left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@lukeholder
lukeholder merged commit d1f2206 into 5.x Sep 2, 2026
6 checks passed
@lukeholder
lukeholder deleted the bugfix/variant-sku-format-id branch September 2, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants