Skip to content

Commit ac54594

Browse files
author
Oleksandr Iegorov
committed
MC-38995: Customer group price is not working in product query graphql
1 parent 7597f8b commit ac54594

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ public function execute(ContextParametersInterface $contextParameters): ContextP
4949
{
5050
$customerSession = $this->customerSession;
5151
$customerGroupId = null;
52+
$extensionAttributes = $contextParameters->getExtensionAttributesData();
5253
if ($contextParameters->getUserType() === UserContextInterface::USER_TYPE_GUEST) {
5354
$customerGroupId = Group::NOT_LOGGED_IN_ID;
54-
} elseif ($contextParameters->getExtensionAttributes()->getIsCustomer() === true) {
55+
} elseif (!empty($extensionAttributes) && $extensionAttributes['is_customer'] === true) {
5556
try {
5657
$customer = $this->customerRepository->getById($contextParameters->getUserId());
5758
$customerGroupId = (int) $customer->getGroupId();
@@ -61,7 +62,7 @@ public function execute(ContextParametersInterface $contextParameters): ContextP
6162
}
6263
if ($customerGroupId !== null) {
6364
$customerSession->setCustomerGroupId($customerGroupId);
64-
$contextParameters->addExtensionAttribute('customer_group', (int) $customerGroupId);
65+
$contextParameters->addExtensionAttribute('id_customer_group', (int) $customerGroupId);
6566
}
6667
return $contextParameters;
6768
}

app/code/Magento/CustomerGraphQl/etc/extension_attributes.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@
99
<extension_attributes for="Magento\GraphQl\Model\Query\ContextInterface">
1010
<attribute code="is_customer" type="boolean"/>
1111
<attribute code="id_customer_group" type="integer"/>
12-
<attribute code="customer_group" type="integer"/>
1312
</extension_attributes>
1413
</config>

0 commit comments

Comments
 (0)