checkoutUpdateVoucher Mutation
Description
Applies or removes a voucher discount from the checkout. Only one voucher can be applied at a time.
mutation checkoutUpdateVoucher(
$checkoutRef: ID!
$voucherRef: ID
$version: Int
) {
checkoutUpdateVoucher(
checkoutRef: $checkoutRef
voucherRef: $voucherRef
version: $version
) {
_id
id
version
origin
created
shipping {
status
fulfilled
date
method
freeShippingThreshold
tracking
shopCollection
weight
packingSlip
}
billing {
status
fulfilled
paymentDate
refundDate
}
orderId
note {
date
content
}
totals {
subtotal
subtotalBeforeTaxes
tax
grand
leftToPay
itemQuantity
discount
shipping
creditNote
balance
}
items {
_id
quantity
unavailable
added
}
buyer {
_id
firstName
lastName
email
name
path
telephone
organisation
taxNumber
}
seller {
type
name
email
ref
}
updated
expires
status
urls {
checkout
storefront
}
useSingleAddress
taxProfile {
isNationalShipping
}
locationRef
}
}
Variables
{
"checkoutRef": "d2ce61ab138864936a7ca3e6",
"voucherRef": "90cc7dc6fa201947259286ff",
"version": 42
}
Response
{
"checkoutUpdateVoucher": {
"_id": "920cc70c8a5dcfdf5b24c26b",
"id": "8k8-Iqtfh",
"version": 42,
"origin": "example",
"created": 1766015688450,
"shipping": {
"status": "Pending",
"fulfilled": true,
"date": 1733492385007,
"method": "example",
"freeShippingThreshold": 1.23,
"tracking": "example",
"shopCollection": true,
"weight": 1.23,
"packingSlip": "example"
},
"billing": {
"status": "example",
"fulfilled": true,
"paymentDate": 1741356407721,
"refundDate": 1752872683667
},
"orderId": "example",
"note": {
"date": 1761405464669,
"content": "example"
},
"totals": {
"subtotal": 1.23,
"subtotalBeforeTaxes": 1.23,
"tax": 1.23,
"grand": 1.23,
"leftToPay": 1.23,
"itemQuantity": 1.23,
"discount": 0.1,
"shipping": 1.23,
"creditNote": 1.23,
"balance": 1.23
},
"items": [
{
"_id": "009c3c519539883f9db1d4e2",
"quantity": 1,
"unavailable": true,
"added": 1779800146689
}
],
"buyer": {
"_id": "2f548d52f2c4171564700634",
"firstName": "example",
"lastName": "example",
"email": "email@example.com",
"name": "example",
"path": "/release/1763553751/release-artist-release-name",
"telephone": "example",
"organisation": "example",
"taxNumber": "example"
},
"seller": {
"type": "example",
"name": "example",
"email": "email@example.com",
"ref": "129b89c8a29682a173e1ae89"
},
"updated": 1742825403862,
"expires": 1774964410526,
"status": "open",
"urls": {
"checkout": "example",
"storefront": "example"
},
"useSingleAddress": true,
"taxProfile": {
"isNationalShipping": true
},
"locationRef": "24bbd9a4e7bd3d50ffc55e53"
}
}
Arguments
| Name | Type | Description |
|---|---|---|
checkoutRef | ID! | Reference ID of the checkout to update. |
voucherRef | ID | Reference ID of the voucher to apply. If null, removes the current voucher. |
version | Int | Current version number of the checkout for optimistic locking. Prevents conflicts when multiple users edit simultaneously. |