customerGroup query
data-variant=info
data-slots=text
This query was created for the Storefront Compatibility Package and is now available on Adobe Commerce 2.4.9.
The customerGroup query provides encoded ID of a customer group assigned to the logged-in customer or guest shopper.
To retrieve customer group for a customer, we recommend you use customer tokens in the header of your GraphQL calls. However, in case of guest information, token should not be passed.
Syntax
{customerGroup: {CustomerGroupStorefront!}}
Example usage
The following call returns encoded ID of customer group for logged-in customer or guest. Provide the customer's token in the header section of the query in case of logged-in customer.
Request:
{
customerGroup {
uid
}
}
Response:
{
"data": {
"customerGroup": {
"uid": "MA=="
}
}
}