Storefront API Discount code view

Highlighted
Shopify Partner
2 0 1

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
Highlighted
Excursionist
14 0 4

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.

0 Likes
Highlighted
Excursionist
14 0 4

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?

0 Likes
Highlighted
Excursionist
14 0 4

Figure out that you can spread a fragment like:

```

...on DiscountCodeApplication {

  code

}

```

 

Works great!

2 Likes
Highlighted
New Member
1 0 0

Thanks !

0 Likes