Skip to content

Commit a675e30

Browse files
committed
#28563: Add customerGroupId to Context without explicit 'this is customer' check
1 parent d0f3415 commit a675e30

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

app/code/Magento/CustomerGraphQl/Model/Context/AddUserInfoToContext.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,14 @@ public function execute(ContextParametersInterface $contextParameters): ContextP
5959

6060
$contextParameters->addExtensionAttribute('is_customer', $this->isCustomer($currentUserId, $currentUserType));
6161

62-
if ($this->isCustomer($currentUserId, $currentUserType)) {
63-
try {
64-
$customerGroupId = $this->customerRepository->getById($currentUserId)->getGroupId();
65-
} catch (\Exception $e) {
66-
$customerGroupId = GroupInterface::NOT_LOGGED_IN_ID;
67-
}
68-
69-
$contextParameters->addExtensionAttribute('customer_group_id', $customerGroupId);
62+
try {
63+
$customerGroupId = $this->customerRepository->getById($currentUserId)->getGroupId();
64+
} catch (\Exception $e) {
65+
$customerGroupId = GroupInterface::NOT_LOGGED_IN_ID;
7066
}
7167

68+
$contextParameters->addExtensionAttribute('customer_group_id', $customerGroupId);
69+
7270
return $contextParameters;
7371
}
7472

0 commit comments

Comments
 (0)