I am trying to calculate the net total price of line items using the REST API after accounting for quantity and total_discount. It is not clear to me whether total_discount needs to be multiplied by quantity or not after reading the docs.
Which of these formulas would be correct?
Net line item price = (line_item.price - line_item.total_discount) * line_item.quantity
Net line item price = (line_item.price * line_item.quantity) - line_item.total_discount
Any help would be much appreciated!
For each given line item,
(line_item.price - line_item.total_discount) accurately represents the line item price after discounts. If this is a discount applying to all line items, then
(line_item.price - line_item.total_discount) * line_item.quantity is applicable. I hope I'm understanding your issue correctly, you should be able to test this pretty easily unless I'm misunderstanding.