For example, imagine that I’m creating an order in Shopify’s Admin portal. I add a line item with 5 quantity and I enter a $0.50 discount for the line. While I entered $0.50 and the UI displays $0.50, the full discount amount is actually $2.50 because the line has 5 quantity, which is fine so far.
When I load the order and its line via GraphQL, various line discount fields report that the discount amount is $2.50. Which makes sense, but what if I want the “unit discount” of $0.50? What’s the most reliable way of getting it? I’m aware that doing some basic math is simple at first, but it’s not as simple once you start factoring in the possibility that the order uses a different presentment currency than the shop currency, since now there’s rounding error and the total discount amount might not be cleanly divisible by the line’s quantity.
Additionally, we’ve encountered issues where certain discount types will be reflected on some line fields such as discount allocations, but not the TotalDiscountSet. So I’m curious about that too.