From a2db5f0d6743f7ecb2f0ccba5a49e844affd8681 Mon Sep 17 00:00:00 2001 From: Andreas von Studnitz Date: Tue, 17 Oct 2023 11:32:05 +0200 Subject: [PATCH] Fix customer group extension attributes This plugin always created a new extension object, regardless of if one already exists. So it overwrote other extension attributes. This change checks if an extension object already exists. --- .../Model/Plugin/GetListCustomerGroupExcludedWebsite.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Model/Plugin/GetListCustomerGroupExcludedWebsite.php b/app/code/Magento/Customer/Model/Plugin/GetListCustomerGroupExcludedWebsite.php index a3adb28da5b4..c856957608f0 100644 --- a/app/code/Magento/Customer/Model/Plugin/GetListCustomerGroupExcludedWebsite.php +++ b/app/code/Magento/Customer/Model/Plugin/GetListCustomerGroupExcludedWebsite.php @@ -64,7 +64,10 @@ public function afterGetList( $customerGroupId = (int)$customerGroup->getId(); if (array_key_exists($customerGroupId, $allExcludedWebsites)) { $excludedWebsites = $allExcludedWebsites[$customerGroupId]; - $customerGroupExtensionAttributes = $this->groupExtensionInterfaceFactory->create(); + $customerGroupExtensionAttributes = $customerGroup->getExtensionAttributes(); + if ($customerGroupExtensionAttributes === null) { + $customerGroupExtensionAttributes = $this->groupExtensionInterfaceFactory->create(); + } $customerGroupExtensionAttributes->setExcludeWebsiteIds($excludedWebsites); $customerGroup->setExtensionAttributes($customerGroupExtensionAttributes); }