Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Order API - Refunds - No refund_line_items

Order API - Refunds - No refund_line_items

syrynj
Visitor
3 0 0

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.


 

Replies 4 (4)

Jonathan-HA
Shopify Partner
334 25 105

Have you already checked the Order Transaction API?  Might be worth checking it out if you haven't already as it might provide additional info.

Co-Founder / Developer at Highview Apps
Our Shopify Apps: EZ Exporter | EZ Inventory | EZ Importer | EZ Notify | EZ Fulfill
syrynj
Visitor
3 0 0

Hi

You mean the section 'transaction' in the refund section?
The one you can also retrieve by doing this: 

/admin/api/2021-10/orders/4125864886459/transactions/5183333793979.json

Well it gives you all details about the financial information, not about the goods.

The goods are covered in the next section ""refund_line_items": []", and this one is empty.

 

Hope Shopify Support or someone else that experienced the same case has some more insight.


Jan

waseemmongdol21
Visitor
1 0 0

did you get the solution if yes then kindly please guide me about this.... thanks in Advance,,,,

russ8
Visitor
3 0 0

When someone refunds the order inside the shopify admin console, they MUST select a line item quantity for the given line item to populate the refund_line_items. When you issued the refund, you probably left both values at 0 and just refunded the money, so there's no way to tell which line item it was associated with. Unfortunately shopify admin console doesn't let you go back and fix it later.