CustomerGroupsQuery
Description
Retrieves all customer groups configured in the system. This query allows you to fetch information about customer groups that can be used for filtering, categorizing, or displaying customer group information.
Endpoint
query allCustomerGroups {
allCustomerGroups {
name
value
}
}
Arguments
This query does not accept any arguments.
Return Values
The query returns an array of CustomerGroup objects with the following fields:
| Field | Type | Description |
|---|---|---|
| name | String | The display name of the customer group. |
| value | String | The identifier or code for the customer group. This value is typically used when assigning a customer to a group. |
Usage Example
query {
allCustomerGroups {
name
value
}
}
Example Response
{
"data": {
"allCustomerGroups": [
{
"name": "General",
"value": "general"
},
{
"name": "VIP",
"value": "vip"
},
{
"name": "Wholesale",
"value": "wholesale"
}
]
}
}
Notes
- This query returns all customer groups configured in the system, regardless of their status.
- Customer groups are typically used for segmenting customers, applying different pricing rules, or providing different access levels.
- The
valuefield is the identifier used when assigning a customer to a group or when filtering customers by group. - If no customer groups are configured in the system, an empty array will be returned.
- If an error occurs during the retrieval of customer groups, an empty array will be returned and the error will be logged.