Skip to content
gist.link ↗

cartApplyDiscount

Mutation Shop API — POST https://shop.api.gist.link/graphql

Apply (or clear, when code is null) a discount code on a cart. PUBLIC.

shop:mutation:cartApplyDiscount

The calling IAM key must hold this permission (or a wildcard that covers it: shop:mutation:* or shop:*) and the access token must have been minted with audience=shop. See Permissions.

type Mutation {
cartApplyDiscount(token: String!, code: String): Cart!
}
Argument Type Required Description
token String! Yes —
code String No —

Cart! — see the Shop types reference.

Terminal window
curl https://shop.api.gist.link/graphql \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-d @- <<'JSON'
{
"query": "mutation CartApplyDiscount($token: String!, $code: String) { cartApplyDiscount(token: $token, code: $code) { id uuid currency created_at updated_at } }",
"variables": {
"token": "example",
"code": "example"
}
}
JSON