addVoucher Mutation
Description
Applies a voucher to a checkout.
mutation addVoucher($id: String!, $voucherId: String!) {
addVoucher(id: $id, voucherId: $voucherId) {
_id
id
configRef
origin
created
shipping {
status
date
method
freeShippingThreshold
tracking
shopCollection
weight
}
billing {
status
paymentDate
refundDate
}
orderId
note {
date
content
}
items {
_id
id
quantity
added
total
unavailable
}
buyer {
_id
email
firstName
id
lastName
name
telephone
organisation
taxNumber
isGuest
}
seller {
_id
id
firstName
lastName
name
email
telephone
taxNumber
}
updated
expires
status
message
totals {
grand
leftToPay
discount
itemsQuantity
itemQuantity
subtotal
subtotalBeforeTaxes
shipping
tax
}
urls {
checkout
storefront
}
useSingleAddress
}
}
Variables
{
"id": "08a16b83-9094-4e89-8c05-2ccadd5c1c7e",
"voucherId": "voucherId"
}
Response
{
"addVoucher": {
"_id": "bdcd56d4cbc38a5f540e591b",
"id": "example",
"configRef": "a3f746a5352d2bff7813241a",
"origin": "example",
"created": 1710570056901,
"shipping": {
"status": "example",
"date": 1728612207629,
"method": "example",
"freeShippingThreshold": 1.23,
"tracking": "example",
"shopCollection": true,
"weight": "example"
},
"billing": {
"status": "example",
"paymentDate": 1727713002386,
"refundDate": 1765031972055
},
"orderId": "example",
"note": {
"date": 1758774037086,
"content": "example"
},
"items": [
{
"_id": "c21d319f3d1c6ae6c28d6872",
"id": "9184d6741f93342ee0104fbd",
"quantity": 1.23,
"added": 1728636126085,
"total": 29.99,
"unavailable": true
}
],
"buyer": {
"_id": "c5dbcd90cc30fd1483294a6c",
"email": "email@example.com",
"firstName": "example",
"id": 1.23,
"lastName": "example",
"name": "example",
"telephone": "example",
"organisation": "example",
"taxNumber": "example",
"isGuest": true
},
"seller": {
"_id": "8dc491091d207687168dbaa2",
"id": "example",
"firstName": "example",
"lastName": "example",
"name": "example",
"email": "email@example.com",
"telephone": "example",
"taxNumber": "example"
},
"updated": 1737528438020,
"expires": 1765073245207,
"status": "example",
"message": "example",
"totals": {
"grand": 1.23,
"leftToPay": 1.23,
"discount": 0.1,
"itemsQuantity": 1.23,
"itemQuantity": 42,
"subtotal": 1.23,
"subtotalBeforeTaxes": 1.23,
"shipping": 1.23,
"tax": 1.23
},
"urls": {
"checkout": "example",
"storefront": "example"
},
"useSingleAddress": true
}
}
Arguments
| Name | Type | Description |
|---|---|---|
id | String! | Checkout identifier string. |
voucherId | String! | Voucher identifier or code. |