From d105f02a2a6336119065d4fdbd79addc6d55ff40 Mon Sep 17 00:00:00 2001 From: Luke Holder Date: Mon, 6 Oct 2025 19:14:25 +0800 Subject: [PATCH] only update canonical --- CHANGELOG.md | 3 ++- src/elements/Product.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d00136ad2..77863091a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ ## Unreleased - Fixed a bug where catalog pricing rules could generate promotional prices for non-promotable purchasables. ([#4118](https://github.com/craftcms/commerce/issues/4118)) -- Fixed a bug where variants weren’t duplicating correctly. ([#4125](https://github.com/craftcms/commerce/issues/4125)) +- Fixed a bug where variants weren't duplicating correctly. ([#4125](https://github.com/craftcms/commerce/issues/4125)) +- Fixed a bug where variant titles were being incorrectly updated when the Variant Title Format referenced the product. ([#4126](https://github.com/craftcms/commerce/issues/4126)) - Fixed a SQL error that could occur when deleting a shipping method. ## 5.4.6 - 2025-09-04 diff --git a/src/elements/Product.php b/src/elements/Product.php index 4cc4728ae8..8bf0ab74ac 100644 --- a/src/elements/Product.php +++ b/src/elements/Product.php @@ -1807,7 +1807,8 @@ public function beforeSave(bool $isNew): bool { $productType = $this->getType(); - if (!$productType->hasVariantTitleField && + if ($this->getIsCanonical() && + !$productType->hasVariantTitleField && $productType->variantTitleFormat && StringHelper::containsAny($productType->variantTitleFormat, ['product.', 'owner.', 'primaryOwner.']) ) {