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": "a1d1e67268c91eec8e46b1b8",
"voucherRef": "d280f3a91859a9e05857bc59",
"version": 42
}
Response
{
"checkoutUpdateVoucher": {
"_id": "ca5cc4dbae8ac3b42f29fb96",
"id": "ZeI-JqwyL",
"version": 42,
"origin": "example",
"created": 1776247837898,
"shipping": {
"status": "Pending",
"fulfilled": true,
"date": 1771906057837,
"method": "example",
"freeShippingThreshold": 1.23,
"tracking": "example",
"shopCollection": true,
"weight": 1.23,
"packingSlip": "example"
},
"billing": {
"status": "example",
"fulfilled": true,
"paymentDate": 1771887268627,
"refundDate": 1750619162964
},
"orderId": "example",
"note": {
"date": 1765005115340,
"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": "c9fe334038943d199f8bfe68",
"quantity": 1,
"unavailable": true,
"added": 1787155230650
}
],
"buyer": {
"_id": "7dba692b65a4fa9c4b1c79c1",
"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": "60b7faa5102eacf516ffa24a"
},
"updated": 1769716167213,
"expires": 1754303854697,
"status": "open",
"urls": {
"checkout": "example",
"storefront": "example"
},
"useSingleAddress": true,
"taxProfile": {
"isNationalShipping": true
},
"locationRef": "965c25ef43959d9e50a0d30c"
}
}
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. |