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:
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,
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:
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
Solved! Go to the solution
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