Discussing APIs and development related to customers, discounts, and order management.
Dear Shopify technical team, I am a Shopify developer and I have encountered some issues when calling the API /admin/api/2021-01/orders.json to retrieve partially_refunded orders. As far as I know, some of the products in these orders may be in a refunded status while others may not. I have tried to use the fulfillable_quantity field to distinguish between these statuses, but it seems that this field only tells me the inventory situation and cannot directly help me determine which products have been refunded and which ones have not. I would like to ask if there are other ways or fields that can accurately tell me which products in the partially_refunded orders have been refunded and which ones have not? If fulfillable_quantity cannot be used to distinguish between them directly, how should I proceed? If you need more information about my use case or the details of my question, please let me know. I am looking forward to your reply and Thank you very much! Wishing you all the best!
Hi there!
According to this forum post you can make a call to GET /admin/api/2021-01/orders.json and then add a search syntax parameter for retrieving only refunded o partially refunded orders like financial_status=refunded or financial_status=partially_refunded. Which might help you to filter the data you're looking for.
Additionally the order resource has a `refunds` property that will return an array of refund objects. Each refund object contains information about the refunded items, including the line items included in the refund along with restocking instructions. There is a stack overflow post here which explores a similar issue to accessing refunded aspects of orders.
Within each refund object, check the line_items array to see which products have been refunded. By examining the refunds property within the order object or utilizing the Refund API, you should be able to accurately determine which products in partially refunded orders have been refunded and which have not.
Additionally, you could use the Refund API to create and retrieve refunds on orders, which will also provide information on which products have been refunded.
Hope this helps!
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog