I was just wondering, in the discount parts of the orders, if there’s any way to retrieve extra information about the discount?
I see in the response I can see an overall “total_discounts” on the order itself, but I cannot see discount details (ie whether it’s a specific shipping discount that was used, or what the code was that the person used etc, what the discount per line item is). I see there is a discount on the line item itself (“taxless_discount_per_unit”) but it always appears to be 0.00 in our case even when there is a “total_discount” on the order.
I was just wondering if this is something that is available that I cannot see? Or whether I’m understanding it correctly?
Sooo… If I were to grab this total_discount, and distribute it evenly across line items, would I need to bear taxless_discount_per_unit in mind? Or does total_discount include taxless_discount_per_unit, so I could effectively just ignore taxless_discount_per_unit?
Also, I presume total_discount includes any shipping discounts? Sorry… Fun coding! And I presume total_discount has had no tax alterations?
Sorry about the delayed reply on this. I wanted to make sure that the answer was correct as does tend to be a bit complex. This is the answer from our CTO Daniel:
total_discounts indeed incorporate all discounts of line items plus additional_order_level_taxless_discount plus shipping discount which we currently do not expose via API.
But you often see taxless_discount_per_unit being 0.0 because in some cases we do not extract detailed discount data while fetching orders from remote sales channels.
Even distribution of total_discounts over line items definitly will not work since there are also additional_order_level_taxless_discount and shipping discount.
That’s great, thanks so much. Sorry for the confusion here - basically, we’re building a system and the way we use discounts in our accounting is that you apply discounts to the line items, not the order itself… So in this case, because we don’t have access to the original discount information on the line items, we need to distribute the discount across the line items in order for this to be the same as everything else.
So aslong as ALL the discount information is in total_discounts, this should all work for us fine! Thank you very much for explaining it