Our application is failing to create fulfillments sometimes in Shopify, but we’re getting very little debug information back. Can someone help troubleshoot?
I didn’t include IDs to be safe, but here’s all the details!
ShopifyAPI::Fulfillment.save! is returning InvalidResource with no clarifying details (message and to_s just return Failed.).
The order we’re updating…
- Has several items that are split in our system across two fulfillments. In our system, we’ve had to cancel and replace the fulfillment a few times, but that hasn’t been accepted in Shopify.
- Instead, we made and shipped one fulfillment in shopify (correct), but the other allowed us to create and cancel a shipment once in Shopify, but we cannot create the new fulfillment to replace it.
- The timeline in shopify looks like this:
- Fulfillment 1 created
- Fulfillment 2 created
- Fulfillment 2 marked as fulfilled
- Fulfillment 1 canceled
- Fulfilment 2 delivered
- (we’ve been trying to make the replacement for fulfillment 1 periodically since it was canceled)
We’re using ruby 2.6.7 and we’re just calling ShopifyAPI::Fulfillment new and save! sequentially.
The new call is: ShopifyAPI::Fulfillment.new(order_id, **arguments). I’ve confirmed we are always providing the shopify order ID and arguments always has this exact format:
{ location_id: int, exists in shopify, and always not nil,
tracking_number: nil,
status: “open”,
line_items: [
{ id: string, exists in shopify, and always not nil,
quantity: int, always not nil, and matches shopify in the cases I’ve seen)
}
…
]
}