Hi All
I want to know how everyone is calculating unit price of an item after discounts?
Suppose i have an order with an item that’s having a line discount of 2$ each and a total order discount of 10% for the entire order
Initially my orders.json api gives me a single line_item like below
{
price: 9
current_quantity:3
discount_allocations:{ {amount:6}, {amount:2.10} }
}
Here,I can calculate the total price of each item after discount by : (price*qty - discounts) / qty
which would be (9*3)-(6+2.1)= 18.9 which is correct
But if i refund 1 qty to the customer then the line_item in order object would be
{
price: 9
current_quantity:2
discount_allocations:{ {amount:6}, {amount:2.10} }
}
which is not correct.Shouldn’t it should be
{
price: 9
current_quantity:2
discount_allocations:{ {amount:4}, {amount:1.4} }
}
Since the discounts are (2$ * qty) and 10% . Why is the discount_allocation not altering after a refund?
The reason i need to find each item single unit price is because if i need to do a refund from our side and we need to know how much a customer pay for each single unit . any one have any suggestions? or Am I looking at wrong fields?