Hi
I am testing integration between Shopify and our system and had a question about how discounts are shown in graph ql.
My test scenario is:
I have an order with 2 items. There is item discount of 10% on one item. There is also an order discount of 10$ on this order. I need to import this order into my system.
The query I am using to get discount data is:
query GetOrderDiscountAllocations {
order(id: “gid://shopify/Order/6435656401094”) {
id
name
discountApplications(first: 10) {
edges {
node {
allocationMethod
targetSelection
targetType
value {
... **on** MoneyV2 {
amount
currencyCode
}
... **on** PricingPercentageValue {
percentage
}
}
}
}
}
lineItems(first: 10) {
edges {
node {
id
title
discountAllocations {
allocatedAmount {
amount
currencyCode
}
discountApplication {
allocationMethod
targetSelection
targetType
value {
... **on** MoneyV2 {
amount
currencyCode
}
... **on** PricingPercentageValue {
percentage
}
}
}
}
}
}
}
}
}
In the data retrieved, I am see the following:
{
"data": {
"order": {
"id": "gid://shopify/Order/6435656401094",
"name": "#3007",
"discountApplications": {
"edges": \[
{
"node": {
"allocationMethod": "ACROSS",
"targetSelection": "ALL",
"targetType": "LINE_ITEM",
"value": {
"amount": "10.0",
"currencyCode": "USD"
}
}
},
{
"node": {
"allocationMethod": "EACH",
"targetSelection": "ENTITLED",
"targetType": "LINE_ITEM",
"value": {
"percentage": 10.0
}
}
}
\]
},
"lineItems": {
"edges": \[
{
"node": {
"id": "gid://shopify/LineItem/15095136911558",
"title": "Lego 500 piece set",
"discountAllocations": \[
{
"allocatedAmount": {
"amount": "1.82",
"currencyCode": "USD"
},
"discountApplication": {
"allocationMethod": "ACROSS",
"targetSelection": "ALL",
"targetType": "LINE_ITEM",
"value": {
"amount": "10.0",
"currencyCode": "USD"
}
}
}
\]
}
},
{
"node": {
"id": "gid://shopify/LineItem/15095136944326",
"title": "Acer Laptop Computer",
"discountAllocations": \[
{
"allocatedAmount": {
"amount": "8.18",
"currencyCode": "USD"
},
"discountApplication": {
"allocationMethod": "ACROSS",
"targetSelection": "ALL",
"targetType": "LINE_ITEM",
"value": {
"amount": "10.0",
"currencyCode": "USD"
}
}
},
{
"allocatedAmount": {
"amount": "50.0",
"currencyCode": "USD"
},
"discountApplication": {
"allocationMethod": "EACH",
"targetSelection": "ENTITLED",
"targetType": "LINE_ITEM",
"value": {
"percentage": 10.0
}
}
}
\]
}
}
\]
}
}
},
"extensions": {
"cost": {
"requestedQueryCost": 21,
"actualQueryCost": 9,
"throttleStatus": {
"maximumAvailable": 2000.0,
"currentlyAvailable": 1991,
"restoreRate": 100.0
}
}
}
}
What is the identifier that can tell me whether a discount is applied on line level or whether a discount is applied to the order?