Hi guys ..
We've developed an integration for a client with a 3PL partner, the integration handles the usual logistical aspects including managing refunds.
So one we get a request to refund an item, we'd fetch the GraphqlOrder & Look for the specified item and then use the value of discountedUnitPrice to calculate the refund amount.
This mostly works, except for cases when the line item is discounted (discount code or shopify script), in which case, the discountedUnitPrice value equals the originalUnitPrice.
So we'd better use the originalUnitPrice instead & calculate the discounted unit price manually using the discountAllocations property.
My question is : Is this is expected behaviour for discountedUnitPrice ? or is it a bug from the Graphql API ?
discountedUnitPrice should indeed be the discounted price: "The price of a single variant unit after line item discounts are applied in shop and presentment currencies."
I'm unable to replicate on a test store - can you please provide an example shop/order ID?
Here are 2 examples for Shop (40728559766) :
- 3741155852438 : the discount applied through the discount code applies to specific items
- 3730827673750 : the discount is applied to the entier shopping cart.
In both cases the value of discountedUnitPrice each line itme equals that of originalUnitPrice.
Thank you for your help in advance