Cannot update fulfillment status on order with lines items belonging to two shipping profiles

Cannot update fulfillment status on order with lines items belonging to two shipping profiles

OhiSweets
Shopify Partner
4 0 0

Hi,

 

I'm running into a problem when trying to fulfill orders on Shopify. Our backend code makes a fulfillment request functionally equivalent to this (in the Python SDK):

 

 

 

order = shopify.Order.find(XXXXXXXXXXX)
location=shopify.Location.find(XXXXXXXXXXX)
fulfillment = shopify.Fulfillment({'order_id': order.id,
                                   'location_id': location.id,
                                   'line_items': order.line_items,
                                   'notify_customer': False})
fulfillment.save()

 

 

 

That works fine most of the time. We've run into a problem lately, however, that seems to affect only orders where there are line items belonging to different shipping profiles. We get a 422 HTTP response and the fairly opaque error message: "An error occurred, please try again." Unfortunately I don't have the request ID. If I try to run the lines above in the terminal, fulfillment.save() returns False. 

 

I can fulfill the same order, however, if I fulfill it one line item at a time, e.g.:

 

 

 

fulfillment = shopify.Fulfillment({'order_id': order.id,
                                   'location_id': location.id,
                                   'line_items': [order.line_items[0]],
                                   'notify_customer': False})
fulfillment.save()

 

 

 

Running this, fulfillment.save() returns True.

 

I've never had to fulfill orders this way before. Why does fulfilling one line item at a time not work but not altogether? Do shipping profiles have anything to do with this? I don't see any noticeable difference between the line items' JSON data (though I do see that the line items have different values for the "vendor" field--could this be the issue? I've found other orders that were successfully marked as fulfilled that had different vendors for the line items). 

 

Any help would be greatly appreciated.

 

Thank you.

Replies 0 (0)