Why is the fulfillments.json API deprecated and how to use fulfillment_orders.json instead?

Why is the fulfillments.json API deprecated and how to use fulfillment_orders.json instead?

Sudheer_Sanagal
Shopify Partner
3 0 1

Hi,

 

We have an integration for a couple of stores with our backend ERP system. Currently, we take the orders and fulfill them ourselves in our own warehouse. We use the REST fulfillments.json api to update tracking info on the orders.

 

Now the fulfillments.json api is deprecated, is there a flow of REST api calls that needs to be used to create fulfillments using the new fulfillment_orders.json

Replies 2 (2)

rabbithole
Visitor
1 0 0

I have spent the day working on this.  My thoughts after today, however I am not sure it is 100% correct.  Based on my environment I am thinking of something like this.  We only fulfill orders from company locations and the entire order comes from 1 or 30 locations.

 

1) Make a request to {shopname}.myshopify.com/admin/api/2022-10/orders/{orderid}/fulfillment_orders.json to get the fulfillmentorderid. 

 

2) Make a request to {shopname}.myshopify.com/admin/api/2022-10/fulfillment_orders/{fulfillmentorderid}/move.json  to move the order to the correct location. Watch for the 422 error here or other errors instead of when then order was fulfilled just in case a location is not assigned to an item in the order.

 
Body of the move request
{
    "fulfillment_order": {
        "new_location_id"{newlocationid}
    }
}
 
3) Make the final request to fulfill the order using a soon to be deprecated but only documented way I can find. You can modify this to fulfill individual items.
{shopname}.myshopify.com/admin/api/2022-10/fulfillments.json
 
Body of the fulfillment request
{
    "fulfillment": {
        "message""The package was shipped.",
        "notify_customer"true,        
        "tracking_info": {
            "number"{trackingnumber}            
        },
        "line_items_by_fulfillment_order": [
            {
                "fulfillment_order_id": {fulfillmentorderid}
            }
        ]
    }
}
 
I got this working manually in Postman but haven't implemented it yet.
Going to think it over.
I don't like using a soon be deprecated API but they don't tell us another way to fulfill an order. 
 
 
colleenc
Shopify Partner
91 9 21

Surprisingly when I tried to use fulfillment_orders.json I was unable to get it to work, but the old fulfillment.json is working fine. Unclear why. I like what you have done here. I need to send out notifications and right now the system is sending one notification per line item when I add the tracking info via json. I am going to try this and see if I can get it to work. Thanks!

 

My current JSON:

 

{
"fulfillment": {
"order_id": {Order: Id},
"tracking_company": "{Carrier}",
"location_id": 18014371875,
"line_items": [
{
"id": {Line Items: Id},
"variant_id": {Line Items: Variant Id},
"quantity": {Quantity Shipped},
"notify_customer": true
}
],
"tracking_number": {Fulfillments: Tracking Number},
"tracking_url": "{Tracking URL}"
}
}