Duplicate Fulfillment Bug (shopify.com issue)

Highlighted
Tourist
3 0 1

I actively maintain a fulfillment service application and have multiple users of the app complaining to us that we are duplicating fulfillments. Looking into it, I have found that in certain circumstances Shopify will create multiple fulfillment objects for a single line item in an order. This seems to be a bug on Shopify's side, and only happens in a certain scenario which I've been able to reproduce below.

 


Steps to Reproduce

 

  1. Create an order with a single item that will be fulfilled through a 3rd party fulfillment service.
  2. Request fulfillment of the item through the Shopify frontend client. The fulfillment should now be in the Requested state.
  3. The fulfillment service app needs to open the fulfillment request. This will cause the fulfillment to move to the Accepted  state.
  4. Use the bulk Fulflll items method on the same order
    Screen Shot 2020-01-20 at 4.01.43 PM.png

  5. On the order page, the fulfillment will now say Requested instead of Accepted.
  6. While the frontend shows only 1 fulfillment object, the Order object taken from the API contains two separate fulfillment objects (with two different IDs) that contain the same exact line item. Two fulfillment created webhooks also get fired off.



Some Notes

  • The duplication bug only happens when the fulfillment is in an Accepted state. If the fulfillment is Complete or Requested then it will not create duplicate fulfillments.
  • There is no way to create multiple fulfillments from a single line item using the API, so I don't think that this is a "feature" that I'm misunderstanding. Trying to create multiple fulfillment objects from the same line item over the API will respond with the following errors depending on the status of the fulfillment.
    [‘Line items are already fulfilled’]
    [‘Fullfillment order can not be in an in progress nor closed state.’]
  • There doesn't seem like an elegant solution on our end to check for these bugs as the come in. Any solutions/ideas appreciated for the short term, but long term this seems like an issue Shopify needs to fix.


1 Like
Highlighted
Shopify Staff
Shopify Staff
152 19 15

Hey @dsdev,

 

Thanks for bringing this up, I'm investigating now. I also wanted to clarify, is there a valid use-case for using the bulk fulfill option on orders that already have a fulfillment in progress? It seems to me like there isn't a valid use-case for this, but just wanted to make sure I'm not missing anything.

JB | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
Tourist
3 0 1

@_JB 

There isn't a need to re-fulfill an already in progress fulfillment. 
But to understand the user actions more, they are stores with hundreds/thousands of new orders every day, so using the bulk fulfill method, after using the bulk select in the ResourceList, is the easiest way to fulfill all these orders at once.

If you look at the computed order fulfillment statuses and filters on the order page, there is no way to even filter for just unfulfilled (order) / unrequested (fulfillments) on the order page. You can see below how an In Progress order with an accepted fulfillment still shows up when i filter by Unfulfilled. 

Regardless of the Fulfillment Status Filter logic, I think the correct thing to do would be to never be able to create multiple fulfillment objects for the same line item / quantity, which effectively changes the cart size quantity when added together. This probably means the bulk fulfill method silently does nothing if its already accepted (in the same exact way it silently does nothing if the fulfillment object is complete).

Screen Shot 2020-01-22 at 12.38.24 PM.png
Screen Shot 2020-01-22 at 12.38.52 PM.png

0 Likes
Shopify Staff
Shopify Staff
152 19 15

Hey @dsdev,

 

I completely agree, I've raised the issue with our developers and I'll post back here soon as I have an update for you.

JB | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
Tourist
3 0 1

@_JB 

 

Is there an update on this?

0 Likes