Storefront API Discount code view

Storefront API Discount code view

cocobum_Admin
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?

Replies 4 (4)

Jordan_Cooperm1
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.

Jordan_Cooperm1
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?

Jordan_Cooperm1
Excursionist
14 0 4

Figure out that you can spread a fragment like:

```

...on DiscountCodeApplication {

  code

}

```

 

Works great!

pqben
Visitor
1 0 0

Thanks !