Skip to content

Commit

Permalink
Merge pull request #1326 from craftcms/bugfix/parse-twig-variant
Browse files Browse the repository at this point in the history
ParseTwig setting not working on Variants
  • Loading branch information
angrybrad authored Oct 9, 2024
2 parents 08f5c31 + 7c090c3 commit 7b0737e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion src/elements/CommerceProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ private function _parseVariants($event): void
}
}

$parseTwig = Plugin::$plugin->service->getConfig('parseTwig', $feed['id']);

foreach ($variantData as $variantContent) {
$attributeData = [];
$fieldData = [];
Expand All @@ -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;
}
}

Expand Down

0 comments on commit 7b0737e

Please sign in to comment.