Best Way to get Products cancelled/refunded from Order webhook

Shopify Partner
65 3 9

If an order update is done in the admin panel to remove/refund a product or reduce it's count, we get an Order Updated webhook with an Order object.

In the admin panel you see the item as removed:

2021-04-06 14_55_09-removed items.jpg

But the line_items properties are a bit difficult to interpret faithfully.

fulfillable_quantity: The amount available to fulfill, calculated as follows:

quantity - max(refunded_quantity, fulfilled_quantity) - pending_fulfilled_quantity - open_fulfilled_quantity

Where do these values come from: "refunded_quantity", "fulfilled_quantity", "pending_fulfilled_quantity" and "open_fulfilled_quantity"? These are not line_item properties.

In this example, the line_item shows:



"quantity": 2,
"fulfillable_quantity": 0,
"fulfillment_status": null



Ideally we want the "refunded_quantity", but where do I get it from?

We looked at GraphQL as an alternate...though not ideal as we'd already receive the Order Webhook, and would then have to make another call to get essentially the same data, but from Graph.

Here's the same line item via graph:



"quantity": 2,
"fulfillableQuantity": 0,
"nonFulfillableQuantity": 2,
"refundableQuantity": 0,
"fulfillmentStatus": "unfulfilled",



But this is also confusing.

fulfillableQuantity (Int!)
The total number of units to fulfill.

Is it safe to assume that a fulfillableQuantity of 0 always reflects the ordered qty - the cancelled qty - fulfilledQty? i.e. could "fulfillable" also be 0 because available inventory is 0?

What does "nonFulfillableQuantity" mean exactly? From the docs

nonFulfillableQuantity (Int!)

A count of the number of line items that cannot be fulfilled.

Well, that's not correct...I assume they mean the quantity of the item that can't be fulfilled....but why can't it be fulfilled...because it was cancelled/refunded, because the inventory is short?

I also see this which may be helpful:

refundableQuantity (Int!)

The line item's quantity minus its refundedQuantity.



"message": "Field 'refundedQuantity' doesn't exist on type 'LineItem'",


I just want the refunded quantity....what is the best way to get it

Chad Richardson
Mozzo Software - Modular Software that grows with you from solopreneur to a 200 person mega team. Why keep outgrowing your Shopify Apps? Start with us, and just use the modules you need, then add more as you grow.
Shopify Staff
Shopify Staff
37 5 5

This is an accepted solution.

To answer the question on refunded quantity, the order object contains refunds and refunds contains RefundLine Items. RefundLine items references back to the line item that was refunded and has quantity, as shown in the attached image. 


For more info on the details of refundLine items have a look here


To answer "What does "nonFulfillableQuantity" mean exactly?" This can mean that the product is not a physical item and doesn't require shipping, ie a digital download


marcusradica | Developer @ 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 or the Shopify Web Design and Development Blog