We are developing an integration for shopify on our platform, specifically order refunds and returns processes. However i’m confused about the correct method for calculating refund for a set of line items.
There’s a deprecated calculateRefund REST API, but no graphql equivalent for it.
There’s also a suggested refund connection on the order object, but that only provides maximum refund. All other fields are always 0. Also this object is generic and there’s no way to pass refund line items.
What is currently the way to calculate shopify suggested refund for a selected set of line item?
Hi @Alevelagency , Thanks for the response.
Can i ask a followup question?
How would i would separate line-items quantities in categories of <fulfilled+refundable> items and <unfulfilled+refundable>, the order query gives refundableAmount for each line item and i can calculate refunded/fulfilled quantity as well for each line item using refunds/fulfillments object on the order. However there doesn’t seem to be a way to find out for each refund whether the line item that was refunded was fulfilled or not. I basically need this to handle stocking differences for each kind of refund.
Can you help me with this if you are familiar with the GraphQL api?
Hi thanks again for getting back,
I’m confused about this
const fulfilledRefunded = Math.min(refundedQty, fulfilledQty);
refundedQuantity can also contain items that weren’t yet fulfilled right?
in that case this calculation will be off.
Imagine for a line item
6 total items
3 total refunds (2 for fulfilled, 1 refund for non fulfilled item)
4 fulfills
1 item yet to be fulfilled
here we should get
2 fulfilled_refunds
1 unfulfilled_refunds
but we’ll get
3 fulfilled_refunds
0 unfulfilled_refunds
Or am i missing something?