I’ll try to keep this simple. Here is what I have done to achieve a process very similar to the soon to be deprecated procedure. I’m going to make a couple of assumptions.
Based on the old logic, you probably already have a way to figure out the order id of your order you want to do a fulfillment on. Don’t need to change that. On my end, I just updated to 2023-01 and still worked.
Now for the added steps.
admin/api/2023-01/orders/{orderid found above}/fulfillment_orders.json?status=open
This call will get you the open fulfillment order id and all the line item ids for that fulfillment (note they are different than the order so if you were using those in the above step to process tracking number for individual line items, you need them from here now. Once the order is “fulfilled” this id becomes locked. In testing, I went to the manually went to the admin panel and cancelled the fulfillment. When I ran this again for the same order, I got an entirely new ID.
Do to no multiple tracking numbers via REST API, you need to use GraphQL.
admin/api/2023-01/graphql.json
Still unsure on Content-Type. Some say application/json and some say application/graphql. From Postman, my Content-Type says application/json however on the Body section, there is a radio button for GraphQL and I selected that.
For the body, this will update an entire order with multiple tracking numbers and close the whole order. Basically all the similar functionality we were used to the old way with a little different syntax. And yes, you have to use the gid url instead of just the number now.
mutation { fulfillmentCreateV2(fulfillment: {
lineItemsByFulfillmentOrder: [
{
fulfillmentOrderId: “gid://shopify/FulfillmentOrder/{fulfillmentorderid}”,
}
],
notifyCustomer: true,
trackingInfo: {
company: “FedEx”,
numbers: [
“394061616238”,“394061616239”
]
}
},
message: “”
) {
fulfillment {
legacyResourceId
}
userErrors {
field
message
}
}
}
Directly below fulfillmentOrderId, you could add the below to update specific line items/qty to not close the entire order with a single set of tracking numbers.
fulfillmentOrderLineItems: {
id: “gid://shopify/FulfillmentOrderLineItem/{fulfillmentorderlinenumber}”,
quantity: 1
}
You can add the urls right below the number if it’s not a common carrier that Shopify already translates for you.
urls: [
“https:/track.com/12345”,“https://track.com/1234”
]