Storefront API Discount code view

I know this must exist, but I just can’t find it. I have applied a discount code op to my checkouts using the graphql mutation checkoutDiscountCodeApply

mutation checkoutDiscountCodeApply($discountCode: String!, $checkoutId: ID!) {
checkoutDiscountCodeApply(discountCode: $discountCode, checkoutId: $checkoutId) {
userErrors {
field
message
}
checkout {
id
}
}
}

This works fine in that the price updates. What I’m looking for is the discounts applied, and hopefully a 'before / after" prices from the discounts, but I can’t seem to find this in the specs. Any ideas?

1 Like

I have the same question. How can I get the discount as a line item inside the checkout response? It’s great that it’s applied to the totals inside of the checkout object, but if I can’t see it, my customers will be confused about if the discount was applied.

I see that discountApplications is now available on the checkout object which is great. Is it possible to also get the discountCode from the applications?

Figure out that you can spread a fragment like:


...on DiscountCodeApplication {

code

}

Works great!

2 Likes

Thanks !