diff --git a/CHANGELOG.md b/CHANGELOG.md index 7aba1298..a6f64f36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased - Fixed a bug where Lightswitch fields would not import correctly when nested in a Matrix or Super Table field. ([#1529](https://github.com/craftcms/feed-me/pull/1529)) +- Fixed a bug where Commerce Variant attributes were not respecting the `parseTwig` config setting. ([#1326](https://github.com/craftcms/feed-me/pull/1326)) ## 5.8.0 - 2024-09-25 diff --git a/src/elements/CommerceProduct.php b/src/elements/CommerceProduct.php index 246024e8..b342186f 100644 --- a/src/elements/CommerceProduct.php +++ b/src/elements/CommerceProduct.php @@ -395,6 +395,8 @@ private function _parseVariants($event): void } } + $parseTwig = Plugin::$plugin->service->getConfig('parseTwig', $feed['id']); + foreach ($variantData as $variantContent) { $attributeData = []; $fieldData = []; @@ -404,7 +406,7 @@ private function _parseVariants($event): void if (Hash::get($fieldInfo, 'attribute')) { $attributeValue = DataHelper::fetchValue(Hash::get($fieldInfo, 'data'), $fieldInfo, $this->feed); - $attributeData[$fieldHandle] = $attributeValue; + $attributeData[$fieldHandle] = $parseTwig ? DataHelper::parseFieldDataForElement($attributeValue, $this->element) : $attributeValue; } }