Skip to main content

Adding Items

New Items

The addToCart mutation allows you to add items:

mutation AddToCart($cartId: uuid!, $quantity: Int!, $variantId: uuid!, $modifiers: [AppliedModifiersParams!]) {
addToCart(cartId: $cartId, quantity: $quantity, variantId: $variantId, modifiers: $modifiers) {
id
}
}

Example variables:

{
"cartId": "1cd751e4-cacd-4244-9022-68068e5f13bb",
"modifiers": [
{
"modifierGroupId": "d84795f7-c6a1-4df4-9b95-5625416f80dd",
"modifierId": "7fcf9677-9e09-43dd-9815-f54c837c6f62",
"quantity": 1
}
],
"quantity": 1,
"variantId": "e99f5f1d-4548-46d1-89bc-e65f6cfcb4fd"
}

If there are no modifiers then the modifiers variable can be left out.

Changing quantity

The updateOrderItemQuantity mutation can be used to change the quantity of an order item:

mutation UpdateOrderItemQuantity($id: uuid!, $quantity: Int!) {
updateOrderItemQuantity(id: $id, quantity: $quantity) {
id
}
}

Example variables:

{
"id": "8630a61c-a744-4449-9fa8-c866111216d9",
"quantity": 2
}

Where id is the id of the order item.