Hi,
We are using the API extensively for book keeping synchronisation.
Recently we have a special case.
One on the webshop co-workers refunded an order due to a loss by the postal service.
So she issued a refund and probably unchecked the box ‘Restock item’.
(I don’t know exactly, I have to reverse engineer to understand how the api dataset is what it is)
"refunds": [
{
"id": 825220858043,
"admin_graphql_api_id": "gid://shopify/Refund/825220858043",
"created_at": "2021-12-20T12:03:26+00:00",
"note": "Lost in Post ",
"order_id": 4194661105851,
"processed_at": "2021-12-20T12:03:26+00:00",
"restock": false,
"total_duties_set": {
"shop_money": {
"amount": "0.00",
"currency_code": "EUR"
},
"presentment_money": {
"amount": "0.00",
"currency_code": "EUR"
}
},
"user_id": 76003410107,
"order_adjustments": [
................
],
"transactions": [
...............
],
"refund_line_items": [],
"duties": []
}
the restock=false
But also the refund_line_items are empty.
This order has 2 items, and were shipped separately.
One of the items was lost, customers complains, a refund is issued.
There is no restock possible, because there is no item to put back in the stock
So how do I know what item to unbook in the booking system that corresponds with the refund?
Do need to start comparing the price of each product-item and hope to have a match with the refund amount?
That is ludicrous.
I saw in the documentation that “restock” as attribute is deprecated.
It this problem linked to that?
Is the logic here that when an item does not need restock it is not in the refund_line_items list ?
What I need is a way to detect what item was refunded, without having to check the ‘restock’ box.
Or I need to instruct the team to never uncheck the refunded box and find another way to discover whether the item was returned or not to do a proper loss calculation.
(Adding metafields is not possible yet for Orders)
I hope others experienced a similar case or the Shopify API Support Team has an answer to get out of this.
Another glitch in the system:
What if I want to refund 2 items of an order, and only want to restock 1 item of the two (other is lost in transport)?
The checkbox is by default on ALL items.
A workaround is to create 2 separate refunds, one with restock=true and one with restock=false.