Anchor to section titled 'undefined'

cartDiscountCodesUpdate
mutation

Updates the discount codes applied to the cart.


Anchor to cartId
cartId
required

The ID of the cart.

The case-insensitive discount codes that the customer added at checkout.

The input must not contain more than 250 values.


Was this section helpful?

The updated cart.

The list of errors that occurred from executing the mutation.


Was this section helpful?
Hide code
Mutation reference
Copy
mutation cartDiscountCodesUpdate($cartId: ID!) {
  cartDiscountCodesUpdate(cartId: $cartId) {
    cart {
      # Cart fields
    }
    userErrors {
      field
      message
    }
  }
}
Hide code
Input
Copy
{
  "cartId": "gid://shopify/<objectName>/10079785100",
  "discountCodes": [
    "<your-discountCodes>"
  ]
}