cartDiscountCodeAdd
Apply a discount code to the cart
Arguments
| Argument | Type | Description |
|---|---|---|
id | ID! | |
version | String | |
code | String! |
Returns
| Field | Type | Description |
|---|---|---|
cart | Cart | Cart information after discount code is added |
cartErrors | [CartDiscountCodeAddError!] | Error details if discount code addition failed |
Example
mutation { cartDiscountCodeAdd( id: "cart-123", code: "SAVE10" ) { cart { id discountCodes { id code amount { centAmount currency } } total { gross { centAmount currency } } } cartErrors { ... on CartError { code message } } } }{ "data": { "cartDiscountCodeAdd": { "cart": { "id": "id-1", "discountCodes": [ { "id": "id-1", "code": "Example", "amount": { "centAmount": 1, "currency": "EUR" } } ], "total": { "gross": { "centAmount": 1, "currency": "EUR" } } }, "cartErrors": [ { "code": "CART_NOT_FOUND", "message": "Example" } ] } }}The query is the example the schema documents. The response shows its shape with placeholder values.
Served by
| @evolve-framework/commercetools | Resolved |
| @evolve-framework/medusa | Resolved |
| @evolve-framework/sfcc | Resolved |
Used by
The storefront packages that send it, in these GraphQL documents:
- @evolve-storefront/feature-cart:
CartDiscountCodeAdd

