Skip to main content

checkoutAddListing Mutation

Description​

Adds a listing to the checkout. Can be identified by either listingRef or listingId. The line's quantity and price can be set in the same call, as checkoutUpdateLine would set them afterwards.

mutation checkoutAddListing(
$id: String!
$listingRef: ID
$listingId: String
$lineQuantity: Int
$lineBasePrice: Float
$version: Int
) {
checkoutAddListing(
id: $id
listingRef: $listingRef
listingId: $listingId
lineQuantity: $lineQuantity
lineBasePrice: $lineBasePrice
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​

{
"id": "qqK-Vhs4O",
"listingRef": "109bfdb8c523befe1be2f273",
"listingId": "listingId",
"lineQuantity": 42,
"lineBasePrice": 30.7,
"version": 42
}

Response​

{
"checkoutAddListing": {
"_id": "c5bdb9615d9df5f053f89dfc",
"id": "2pH-qXFpi",
"version": 42,
"origin": "example",
"created": 1754010584826,
"shipping": {
"status": "Pending",
"fulfilled": true,
"date": 1773082908915,
"method": "example",
"freeShippingThreshold": 1.23,
"tracking": "example",
"shopCollection": true,
"weight": 1.23,
"packingSlip": "example"
},
"billing": {
"status": "example",
"fulfilled": true,
"paymentDate": 1773805861675,
"refundDate": 1753035820127
},
"orderId": "example",
"note": {
"date": 1792494699572,
"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": "f661431bbde75000ffe4f5e2",
"quantity": 1,
"unavailable": true,
"added": 1781756456506
}
],
"buyer": {
"_id": "5caffb706ff1caf5941759e0",
"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": "c9a9d513fc1096e83cc0f61f"
},
"updated": 1750431944459,
"expires": 1794489040704,
"status": "open",
"urls": {
"checkout": "example",
"storefront": "example"
},
"useSingleAddress": true,
"taxProfile": {
"isNationalShipping": true
},
"locationRef": "af98c9a3f735706a72eed0ca"
}
}

Arguments​

NameTypeDescription
idString!String identifier of the checkout.
listingRefIDReference ID of the listing to add.
listingIdStringIdentifier of the listing to add.
lineQuantityIntQuantity for the new line, at least 1. Defaults to 1.
lineBasePriceFloatBase price for the new line, as checkoutUpdateLine takes it: before taxes when the shop edits prices before taxes, after taxes otherwise. Defaults to the listing's price.
versionIntCurrent version number of the checkout for optimistic locking. Prevents conflicts when multiple users edit simultaneously.

Returns​

Checkout!