Skip to main content

mobileApplyDiscountCode

Requires a customer (portal or buyer app) session.

Apply a discount code to the buyer's shared cart, or clear it with a null or blank code. The same write as the portal's applyDiscountCode. A code that gives this cart nothing is refused with DISCOUNT_CODE_NOT_APPLICABLE, whatever the reason.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

mutation MobileApplyDiscountCode($input: ApplyDiscountCodeInput!) {
mobileApplyDiscountCode(input: $input) {
id
discountCode
addressId
directions
itemCount
subtotal
items {
id
productName
acceptAlternativeIfUnavailable
addedAt
blurhash
conversionFactor
}
}
}

Variables:

{
"input": {}
}

Response:

{
"data": {
"mobileApplyDiscountCode": {
"id": "id",
"discountCode": "string",
"addressId": "id",
"directions": "string",
"itemCount": 0,
"subtotal": 0,
"items": [
{
"id": "id",
"productName": "string",
"acceptAlternativeIfUnavailable": true,
"addedAt": "2025-01-15T00:00:00Z",
"blurhash": "string",
"conversionFactor": 0
}
]
}
}
}
mobileApplyDiscountCode(
input: ApplyDiscountCodeInput!
): MobileCart!

Arguments​

mobileApplyDiscountCode.input ● ApplyDiscountCodeInput! non-null input​

The code, the expected cart revision and the operation ID.

Type​

MobileCart object​

One shared cart per buyer (not per delivery address — the address is chosen at placeOrder). The same cart the customer portal reads and writes (one per branch in branch mode).