Set addresses on the cart
Set the invoice and delivery addresses on the cart before checkout.
Mutation
mutation SetCartAddress($cartId: String!, $input: CartUpdateAddressInput!) {
cartUpdateAddress(
id: $cartId
input: $input
) {
invoiceAddress {
firstName
lastName
company
street
number
postalCode
city
country
email
}
deliveryAddress {
firstName
lastName
company
street
number
postalCode
city
country
}
}
}
Variables
{
"cartId": "019c77b7-565f-7ea0-8660-42bc63a7f728",
"input": {
"type": "INVOICE",
"firstName": "Jan",
"lastName": "de Vries",
"company": "Acme Industrial B.V.",
"street": "Industrieweg",
"number": "42",
"postalCode": "1234 AB",
"city": "Amsterdam",
"country": "NL",
"email": "jan@acme.nl"
}
}
Response
{
"data": {
"cartUpdateAddress": {
"invoiceAddress": {
"firstName": "Jan",
"lastName": "de Vries",
"company": "Acme Industrial B.V.",
"street": "Industrieweg",
"number": "42",
"postalCode": "1234 AB",
"city": "Amsterdam",
"country": "NL",
"email": "jan@acme.nl"
},
"deliveryAddress": {
"firstName": "",
"lastName": "",
"company": "",
"street": "",
"number": "",
"postalCode": "",
"city": "",
"country": "NL"
}
}
}
}
How it works
Call this mutation once for INVOICE and once for DELIVERY — the type field in the input determines which address is set. Required fields are firstName, lastName, street, postalCode, city, and country. The response always returns both addresses so you can confirm the current state. If the delivery address should match the invoice address, send both calls with the same data.