# cartDiscountCodesUpdate Updates discount codes for an existing cart. ## Authentication > **Public Access**: Accessible with the public API key ## Mutation Structure ```graphql mutation { cartDiscountCodesUpdate(id: String!, discountCodes: [String!]) { cart { # Cart fields } userErrors { # UserError fields } } } ``` ## Input Arguments | Argument | Type | Required | Description | |----------|------|----------|-------------| | id | String! | Yes | The ID of the cart to update discount codes for | | discountCodes | [String!] | No | A list of discount codes to apply to the cart | ## Return Type [CartDiscountCodesUpdatePayload](/reference/storefront/v1/objects/cart-discount-codes-update-payload) - Payload returned by the cartDiscountCodesUpdate mutation. Contains an optional updated cart and a required list of user errors that occurred during the update. ## Example ```graphql mutation { cartDiscountCodesUpdate( id: "eyJhbGciOiJIUzI1NiJ9..." discountCodes: ["SUMMER20", "FREESHIP"] ) { cart { id totalQuantity } userErrors { field message } } } ``` ## Related Types - [CartDiscountCodesUpdatePayload](/reference/storefront/v1/objects/cart-discount-codes-update-payload)