--- title: cartDiscountCodesUpdate - Storefront API description: Updates the discount codes applied to the cart. api_version: unstable api_name: storefront source_url: html: https://shopify.dev/docs/api/storefront/unstable/mutations/cartDiscountCodesUpdate md: https://shopify.dev/docs/api/storefront/unstable/mutations/cartDiscountCodesUpdate.md --- # cart​Discount​Codes​Update mutation Updates the discount codes applied to the cart. ## Arguments * cart​Id [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required The ID of the cart. * discount​Codes [\[String!\]!](https://shopify.dev/docs/api/storefront/unstable/scalars/String) required The case-insensitive discount codes that the customer added at checkout. The input must not contain more than `250` values. *** ## Cart​Discount​Codes​Update​Payload returns * cart [Cart](https://shopify.dev/docs/api/storefront/unstable/objects/Cart) The updated cart. * user​Errors [\[Cart​User​Error!\]!](https://shopify.dev/docs/api/storefront/unstable/objects/CartUserError) non-null The list of errors that occurred from executing the mutation. * warnings [\[Cart​Warning!\]!](https://shopify.dev/docs/api/storefront/unstable/objects/CartWarning) non-null A list of warnings that occurred during the mutation. *** ## Examples * ### cartDiscountCodesUpdate reference ## Mutation Reference ```graphql mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!) { cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) { cart { # Cart fields } userErrors { field message } warnings { # CartWarning fields } } } ``` ## Input ```json { "cartId": "gid://shopify//10079785100", "discountCodes": [ "" ] } ``` ##### Variables ``` { "cartId": "gid://shopify//10079785100", "discountCodes": [ "" ] } ```