Storefront Cart API (2022-07 RC) - cartDiscountCodesUpdate not working as expected

It appears that when I try to apply a discount code via cartDiscountCodesUpdate

  • The code is applied

  • The code is returned in Cart.discountCodes

However, Cart.discountCodes[0].applicable is set to false but the total for the cart has changed to reflect the applied discount.

I’m applying a 10% Off coupon and my query looks like this:

mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!, $contextCountry: CountryCode!) @inContext(country: $contextCountry) {
    cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
      cart {
        ...CartFragment
      }
      userErrors {
        field
        message
      }
    }
  }

I should also add, the documentation here has the wrong method signature:

https://shopify.dev/api/storefront/2022-01/mutations/cartDiscountCodesUpdate

Thanks,

Stephen

1 Like

Hi @steveb3210 ,

I just wanted to follow up to let you know an issue has been created on our end to address the applicable issue noted with discount codes. I can’t share any timelines on when the issue will be resolved but can update you when I know more.

I’ve also reached out to the docs team about the code sample having the error so we’ll get that taken care of as well.

Regards,

John

1 Like

< Nevermind, the API changed to handle different types of allocations >