There is a problem calculating discounts in the Orders API when you have an ORDER scoped discount and a LINE_ITEM scoped discount that is for the full amount of the line item. It appears that the ORDER-scope discount is applied to all line items first, even though it is a fixed amount discount.
e.g. with order line items:
- Widget A, $5/ea, qty 100
- Another Thing, $10/ea, qty 1
discounts:
- Scope LINE_ITEM, applied to item 2, $10 fixed amount
- Scope ORDER, $100 fixed amount
We want line item 2 to appear on the order with the amount it would have been, so the customer can see what they would have been charged and the discount showing they were not charged for that item. What happens is the order discount is applied proportionally to the items, so the $100 fixed order discount applies $98 to item 1 and $2 to item 2. The line item discount for item 2 is then only $8. The correct order total would be $400, but the Orders API would give an order total of $402.
If fixed amount line item discounts could be applied to the applicable line items first, these calculations could be more correct.
Currently I’ve worked around this problem by not using line item discounts, since order-scoped discounts appear the same way on an invoice view.