Hello.
On orders created manually (via draft orders), sometimes we apply manual discounts per line. By using the GraphQL API I can get the discounted amount, but I can’t find how to get the discount label. What am I missing?
Regards.
Hello.
On orders created manually (via draft orders), sometimes we apply manual discounts per line. By using the GraphQL API I can get the discounted amount, but I can’t find how to get the discount label. What am I missing?
Regards.
Hi @AntonioC
Is this the discount code you need?
query order($id: ID!){
order(id:$id) {
name
discountCode
discountCodes
discountApplications (first: 5){
edges{
node{
index
}
}
}
}
}
query draftOrder($id: ID!) {
draftOrder(id: $id) {
name
discountCodes
}
}
Hello @kyle_liu
No, I already got the discount codes. What I need is the label to the discount applied to the order line.
When you create an order manually using ‘drafts’, you can set a discount per order line, as you can see on the attached screenshot.
What I need to get is the discount label, ‘VIP Customer discount’ text.
Regards.
Hi @AntonioC
query order($id: ID!){
order(id:$id) {
name
discountCode
discountCodes
discountApplications (first: 5){
edges{
node{
allocationMethod
index
targetType
targetSelection
value {
... on MoneyV2 {
amount
}
}
... on DiscountCodeApplication {
code
index
}
... on ManualDiscountApplication {
title
}
... on ScriptDiscountApplication {
description
title
}
... on AutomaticDiscountApplication{
title
}
}
}
}
}
}
Thanks @kyle_liu !
I didn’t dig enough into the documentation… I’m relatively new to GraphQL, so I didn’t think about union types.
Thanks!