Negative order line item quantity field(s)

I recently came across an order line item with negative unfulfilledQuantity (-1).

Is this expected behaviour?

For reference: order was in partial refund, all line items had fulfillmentStatus: 'fulfilled', and had quantity fields as follows:

{ "currentQuantity": 1, "unfulfilledQuantity": 0,  "refundableQuantity": 1, "quantity": 1, "nonFulfillableQuantity": 0 }
{ "currentQuantity": 1, "unfulfilledQuantity": 0,  "refundableQuantity": 1, "quantity": 1, "nonFulfillableQuantity": 0 }
{ "currentQuantity": 1, "unfulfilledQuantity": 0,  "refundableQuantity": 1, "quantity": 1, "nonFulfillableQuantity": 0 }
{ "currentQuantity": 1, "unfulfilledQuantity": 0,  "refundableQuantity": 1, "quantity": 1, "nonFulfillableQuantity": 0 }
{ "currentQuantity": 1, "unfulfilledQuantity": 0,  "refundableQuantity": 1, "quantity": 1, "nonFulfillableQuantity": 0 }
{ "currentQuantity": 1, "unfulfilledQuantity": 0,  "refundableQuantity": 1, "quantity": 1, "nonFulfillableQuantity": 0 }
{ "currentQuantity": 0, "unfulfilledQuantity": -1, "refundableQuantity": 0, "quantity": 1, "nonFulfillableQuantity": 0 }
{ "currentQuantity": 1, "unfulfilledQuantity": 0,  "refundableQuantity": 1, "quantity": 1, "nonFulfillableQuantity": 0 }
{ "currentQuantity": 1, "unfulfilledQuantity": 0,  "refundableQuantity": 1, "quantity": 1, "nonFulfillableQuantity": 0 }

The docs read as though all of the line item quantity fields should be positive, or zero, but never negative.

If negative values are expected, is there any guidance available to help interpreting these cases?

field type optionality description
currentQuantity Int! non-null The number of units ordered, excluding refunded and removed units.
nonFulfillableQuantity Int! non-null The total number of units that can’t be fulfilled. For example, if items have been refunded, or the item is not something that can be fulfilled, like a tip. Please see the FulfillmentOrder object for more fulfillment details.
quantity Int! non-null The number of units ordered, including refunded and removed units.
refundableQuantity Int! non-null The number of units ordered, excluding refunded units and removed units.
unfulfilledQuantity Int! non-null The number of units not yet fulfilled.
1 Like

Hey @ks982357 negative quantity values does sound like unexpected behavior. Would you be able to share some specific details to help me replicate and verify?

Can you share:

  • The sequence of operations on this order (e.g., created → fulfilled → refunded, or partial fulfillment → refund → additional fulfillment)
  • How these operations were performed (Shopify Admin, your app via API, or a mix)
  • Were returns and refunds created as separate operations on the same line item?
  • If via API, which mutations did you use? (refundCreate, returnCreate, orderEditBegin/Commit, etc.)
  • Have you seen this on multiple orders, or just this one?
  • If multiple, is there a common pattern?

Hey @ks982357, are you still experiencing this issue, or can I mark this as solved?

Hi @KyleG-Shopify, Sorry for the delay getting back to you. For context, our app didn’t modify these orders so I’m not sure if I can get you the sequence of operations you’re after. Only two instances have been observed to date. From the limited information I can see, only references to refunds and the negative quantities stand out on either.

For reference, the second order is c. 2019, no listed refunds, displayFinancialStatus: 'PAID', all line items fulfillmentStatus: 'fulfilled', and quantity fields as follows:

{ "currentQuantity":1, "unfulfilledQuantity":-1, "refundableQuantity":1, "quantity":1, "nonFulfillableQuantity":0 }
{ "currentQuantity":1, "unfulfilledQuantity":-1, "refundableQuantity":1, "quantity":1, "nonFulfillableQuantity":0 }
{ "currentQuantity":1, "unfulfilledQuantity":-1, "refundableQuantity":1, "quantity":1, "nonFulfillableQuantity":0 }
{ "currentQuantity":1, "unfulfilledQuantity":-1, "refundableQuantity":1, "quantity":1, "nonFulfillableQuantity":0 }
{ "currentQuantity":1, "unfulfilledQuantity":-1, "refundableQuantity":1, "quantity":1, "nonFulfillableQuantity":0 }
{ "currentQuantity":1, "unfulfilledQuantity":-1, "refundableQuantity":1, "quantity":1, "nonFulfillableQuantity":0 }
{ "currentQuantity":1, "unfulfilledQuantity":-1, "refundableQuantity":1, "quantity":1, "nonFulfillableQuantity":0 }

If it’s worth passing on these specific order ids for internal investigation I can probably do that directly or via support.

Hey @ks982357, thanks for the additional context. Since your app didn’t perform these operations, the diagnostic details I asked for probably aren’t something you’d have visibility into.

To investigate this properly, our support teams would need to inspect the order timeline and event history directly. Since you’re accessing this store as a third-party app developer rather than the store owner, the merchant would need to open the support ticket with those Order IDs. If you can flag this to them and share a link to this thread for context, that will give support everything they need to dig into what caused the negative values.