Whats the difference between remainingQuantity and totalQuantity on FulfillmentOrderLineItem?

vertalm
Shopify Partner
18 0 14

Currently Im trying to integrate FulFillment Orders.
So, Im using this Object
https://shopify.dev/api/admin-graphql/2022-01/objects/FulfillmentOrderLineItem#top

And every time when i make a call i have same amount in totalQuantity field and remainingQuantity field.
I don't recieve any answer on my previos question and seems part of API, which associated with fulFullment service broken in few places

Can you please check it or fix?

Replies 4 (4)

SB_90
Shopify Partner
216 52 69

Hi @vertalm 

 

From reading the documentation on those two fields:

 

remainingQuantity: The number of units remaining to be fulfilled

totalQuantity: The total number of units to be fulfilled

I would suggest that if you part-fulfil a line item the remainingQuantity is what is still left to be fulfilled.

 

Let's say Line 1 is 10 units - but you only have 2 units in stock - so you fulfill those 2 immediately.

 

That would leave:

remainingQuantity: 8

totalQuantity: 10

 

Whereas if you had enough in stock and you fulfilled all 10 it would be:

 

remainingQuantity: 0

totalQuantity: 10

 

If you haven't yet fulfilled ANY of the units then you'd get the response that you have:

 

remainingQuantity: 10

totalQuantity: 10


That's just my reading of it though - someone in the Shopify team may be able to provide some more clarity.

vertalm
Shopify Partner
18 0 14

Thanks for you answer, but unfortunately thats not work this way
Actually Im trying to send fulfill request for a few items and both numbers always return same amount.

For example line 1 is 10 units
Im trying to send fulfill request for two of them and as result 

remainingQuantity: 2

totalQuantity: 2

 

Will try to go throught next steps...

 

awwdam
Shopify Staff
249 42 36

Hey @vertalm,

If you are still experiencing this and feel the API is returning unexpected data or exhibiting behavior, feel free to head to the Partner Dashboard> Support> Contact Partner Support, then select the option to Report an issue.  

Please include detailed steps to replicate, examples of where you are getting errors as well as x-request-id headers, request body, and links to the documentation being used. There is no guarantee that all requests or bugs reported here are answered directly, however any additional information you can provide around this issue would be very helpful!

- Cheers

awwdam | API Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog

guest4
Shopify Partner
88 6 23

For future readers:

 

Answer:

The remainingQuantity is how many unfulfilled units belong to the fulfillment order line item. The totalQuantity is the total quantity of the items for that fulfillment order line item.

 

Reasoning:

Sound confusing? It is.

 

The reason that we distinguish between the two is because once a fulfillment order is created, a fulfillment service can create multiple fulfillments for it. Only once all of the fulfillment order line items on the fulfillment order have been fulfilled, will the fulfillment order be closed.

 

Example:

This could happen if a customer orders 3 items and the fulfillment service ships one today and the other 2 next week. 

 

In this case, the remainingQuantity is the number of items remaining to be fulfilled. Basically it's a counter.

 

Testing:

To test this yourself:

  1. Submit a fulfillment request with a line item that has a quantity of 2. (Note: For the purpose of the test the items should not be discounted).
  2. Accept the fulfillment request
  3. Check the remainingQuantity and totalQuantity from the fulfillment order's line items.
  4. Create a fulfillment that only has a quantity of 1 of the line items.
  5. Check the remainingQuantity and totalQuantity from the fulfillment order's line items.

Notes: In step 3 you'll see a remainingQuantity of 2 and totalQuantity of 2. In step 5 you'll see a remainingQuantity of 1 and a totalQuantity of 2.

 

Conclusion:

Do this: Use the remainingQuantity field to determine how many items still need to be fulfilled. Do not do this: Use the totalQuantity to determine how many items need to be fulfilled. You risk shipping more items than were ordered.