Skip to main content

Product library

Needs the read:products permission.

The product library is three lists on a site: categories, products and modifierGroups.

Products​

products is paginated.

Request

{
site {
products(first: 200) {
nodes {
id
name
displayName
category { id name department }
allergens
prices { amount orderMode variant taxRatePercent }
modifierGroupId
}
nextCursor
}
}
}

Try it in the explorer

Response

{
"data": {
"site": {
"products": {
"nodes": [
{
"id": "66168c952dacadbfc5e41576",
"name": "Lemonade",
"displayName": "Lemonade",
"category": { "id": "66168c862dacadbfc5e3f9f2", "name": "Soft Drinks", "department": "Wet" },
"allergens": [],
"prices": [
{ "amount": 350, "orderMode": "Sit In", "variant": null, "taxRatePercent": 20 },
{ "amount": 320, "orderMode": "Take Out", "variant": null, "taxRatePercent": 20 }
],
"modifierGroupId": null
},
{
"id": "66336eae98f4389e8af4dcc2",
"name": "Steak",
"displayName": "Sirloin Steak",
"category": { "id": "6622784e10530e5203265c55", "name": "Hot Food", "department": "Dry" },
"allergens": ["Milk"],
"prices": [
{ "amount": 2500, "orderMode": "Sit In", "variant": null, "taxRatePercent": 20 }
],
"modifierGroupId": "66251ef86f004bc90262d436"
}
],
"nextCursor": "Mg"
}
}
}
}

Prices​

A product can have several prices. Each one says when it applies:

FieldMeaning
amountThe selling price, including tax, in pence
orderModeThe order mode this price is for, such as Sit In or Take Out, as named at the site
variantThe variant this price is for, such as a size, where the product has variants
taxRatePercentThe tax rate applied, for example 20
costPriceWhat the product costs you, in pence. Needs read:costs

Cost prices​

costPrice needs the read:costs permission as well as read:products. Leave it out of the query if your key does not have it. It is null where no cost has been entered.

{ site { products(first: 200) { nodes { id name prices { amount costPrice orderMode } } nextCursor } } }

Try it in the explorer

Categories​

Request

{ site { categories { id name department } } }

Try it in the explorer

Response

{
"data": {
"site": {
"categories": [
{ "id": "66168c862dacadbfc5e3f9f2", "name": "Soft Drinks", "department": "Wet" },
{ "id": "6622784e10530e5203265c55", "name": "Hot Food", "department": "Dry" }
]
}
}
}

A product's category carries the same id, so you can join the two.

Modifier groups​

A modifier group is the set of choices offered when a product is sold, such as how a steak is cooked. A product points at its group with modifierGroupId.

Request

{
site {
modifierGroups {
id
name
steps {
position
optional
maxChoices
options { id name price }
}
}
}
}

Try it in the explorer

Response

{
"data": {
"site": {
"modifierGroups": [
{
"id": "66251ef86f004bc90262d436",
"name": "Steak",
"steps": [
{
"position": 1,
"optional": false,
"maxChoices": 1,
"options": [
{ "id": "662520249f51cce4a3e11f8f", "name": "Rare", "price": null },
{ "id": "6625202a9f51cce4a3e11f90", "name": "Medium", "price": null },
{ "id": "662520309f51cce4a3e11f91", "name": "Well Done", "price": null }
]
},
{
"position": 2,
"optional": true,
"maxChoices": 1,
"options": [
{ "id": "6967984193f50ff80073d03f", "name": "Peppercorn Sauce", "price": 250 },
{ "id": "69679845a7a33e0f9787c002", "name": "Bearnaise Sauce", "price": 250 }
]
}
]
}
]
}
}
}

A group is made of steps, asked in position order. Each step offers options; optional says whether a choice can be skipped and maxChoices how many can be picked. An option's price is the extra charged for choosing it, in pence, and is null when there is no charge.

Keeping a copy in step​

The product library changes when someone edits it in the backoffice. To keep your own copy current, read all three lists on a schedule that suits you and replace what you hold, matching on id.