Fetch Delivery Quote
If your order is for delivery you will need to fetch a delivery quote to provide a total price for the order.
This should be done before discounts are applied in case a discount effects the delivery price.
Query to get a delivery quote:
mutation fetchQuoteAndUpdateCart($cartId: ID!, $deliveryAddress: DeliveryAddressParams) {
quoteAndUpdateAddress(cartId: $cartId, deliveryAddress: $deliveryAddress) {
id
deliveryAddress {
zip
}
deliveryCharge
minimumOrderValue
message
status
}
}
The variables need a cart ID and a formatted delivery address:
{
"cartId": "ca9379e5-31fb-4578-a765-f6eb71a38610",
"deliveryAddress": {
"city": "CITY",
"lineOne": "STREET NAME AND NUMBER",
"lineTwo": "",
"zip": "ZIP"
}
}
OK Response:
{
"data": {
"quoteAndUpdateAddress": {
"deliveryAddress": {
"zip": "ZIP"
},
"deliveryCharge": "3.49",
"id": "ca9779e5-31fb-4578-a765-f6eb31a38610",
"message": null,
"minimumOrderValue": "5.09",
"status": "success"
}
}
}
Invalid Response:
{
"data": {
"quoteAndUpdateAddress": null
},
"errors": [
{
"error": "SLERP_INVALID_ADDRESS_TYPES",
"locations": [
{
"column": 0,
"line": 2
}
],
"message": "Sorry your address did not pass our geolocation requirements",
"path": [
"quoteAndUpdateAddress"
]
}
]
}