Skip to Content

cartDiscountCodesUpdate

Updates discount codes for an existing cart.

Authentication

Public Access: Accessible with the public API key

Mutation Structure

mutation { cartDiscountCodesUpdate(id: String!, discountCodes: [String!]) { cart { # Cart fields } userErrors { # UserError fields } } }

Input Arguments

ArgumentTypeRequiredDescription
idString!YesThe ID of the cart to update discount codes for
discountCodes[String!]NoA list of discount codes to apply to the cart

Return Type

CartDiscountCodesUpdatePayload - Payload returned by the cartDiscountCodesUpdate mutation. Contains an optional updated cart and a required list of user errors that occurred during the update.

Example

mutation { cartDiscountCodesUpdate( id: "eyJhbGciOiJIUzI1NiJ9..." discountCodes: ["SUMMER20", "FREESHIP"] ) { cart { id totalQuantity } userErrors { field message } } }