GraphiQL Orders Discounts

Highlighted
Tourist
18 0 0

We are using GraphiQL to fetch orders.

The discounts data is not fit to the UI reports.

 

one order for example,

API discounts - 29,980

UI discounts - 25,193.27

 

The other numbers, like taxes and total sales are fit -> it is not a currency difference.

 

The same results with totalDiscountsSet node and cartDiscountAmountSet node.

 

Please help me to explain the difference.

0 Likes
Highlighted
Tourist
18 0 0

Jumping

0 Likes
New Member
8 0 0

I have the same problem with the REST Admin API. For some orders, I don't get the exact same discount amount. Did you find a solution?

0 Likes
Highlighted
Tourist
18 0 0

No. Waiting for Shopify staff...

0 Likes
Highlighted
Shopify Partner
520 38 109

@Amichay how are you handling the GraphQL API request? Since there are specific fields that need to be referenced to determine the order line item discount amounts. And then you'd need to write code to iterate through the results to tally up the grand total.

For example, below where I'd consider the order's sum lineItem.discountAllocations.allocatedAmountSet.presentmentMoney.amount value to be the discounted amount.

{
  order(id: "gid://shopify/Order/1863955054644") {
    lineItems(first: 5) {
      edges {
        node {
          discountAllocations {
            allocatedAmountSet {
              presentmentMoney {
                amount
                currencyCode
              }
            }
          }
        }
      }
    }
  }
}

 

0 Likes