Fetch a cluster with variant selection config
Retrieve a cluster with its ClusterConfig to build a variant selector (e.g. processor dropdown, memory selector).
Query
query GetClusterVariants($clusterId: Int!) {
cluster(clusterId: $clusterId) {
clusterId
names { language value }
config {
id
name
settings {
id
name
displayType
priority
}
}
drillDowns {
attributeId
priority
displayType
}
products {
productId
names { language value }
attributes(input: { filter: { names: ["PROCESSOR", "RAM_GB"] } }) {
items {
attributeDescription { name }
textValue { values { language value } }
intValue
}
}
}
}
}
Variables
{
"clusterId": 30
}
Response
{
"data": {
"cluster": {
"clusterId": 30,
"names": [{ "language": "NL", "value": "Dell Optiplex 7010 serie" }],
"config": {
"id": 8114,
"name": "DESKTOP_CONFIG",
"settings": [
{ "id": 101, "name": "PROCESSOR", "displayType": "DROPDOWN", "priority": 0 },
{ "id": 102, "name": "RAM_GB", "displayType": "DROPDOWN", "priority": 1 }
]
},
"drillDowns": [
{ "attributeId": "abc-123", "priority": 0, "displayType": "DROPDOWN" },
{ "attributeId": "def-456", "priority": 1, "displayType": "DROPDOWN" }
],
"products": [
{
"productId": 880,
"names": [{ "language": "NL", "value": "Dell Optiplex 7010 - i5 / 16GB / 512GB" }],
"attributes": {
"items": [
{ "attributeDescription": { "name": "PROCESSOR" }, "textValue": { "values": [{ "language": "NL", "value": "Intel Core i5-13500" }] }, "intValue": null },
{ "attributeDescription": { "name": "RAM_GB" }, "textValue": null, "intValue": 16 }
]
}
},
{
"productId": 881,
"names": [{ "language": "NL", "value": "Dell Optiplex 7010 - i7 / 32GB / 1TB" }],
"attributes": {
"items": [
{ "attributeDescription": { "name": "PROCESSOR" }, "textValue": { "values": [{ "language": "NL", "value": "Intel Core i7-13700" }] }, "intValue": null },
{ "attributeDescription": { "name": "RAM_GB" }, "textValue": null, "intValue": 32 }
]
}
}
]
}
}
}
How it works
The config.settings array defines which attributes the frontend uses for variant selection. priority controls display order (lower = first). displayType tells you how to render each selector: DROPDOWN for a select menu, RADIO for radio buttons, COLOR for color swatches, IMAGE for image swatches. When a customer selects values for all settings, match against product attributes to find the corresponding product.