A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi
We were migrating our project to the new fulfillment workflow and has got few doubts regarding the same.
1) We are retrieving the orders using the Admin API GET order.json end point. This endpoint response has got a 'fulfillments' array which is always empty for us. I initially thought we will get the fulfillment IDs from here. As a matter of fact I cannot find any fulfillment IDs in the order response.
https://shopify.dev/docs/api/admin-rest/2022-10/resources/order#post-orders
So in order to get the fulfillment IDs, I am firing the GET Fulfillment_orders Admin API separately for each order. Is that how we should do it?
2) As per the documentation, Fulfillment IDs are created automatically when an order is placed. If that's the case I don't have to create the fulfillment IDs right?
3)How many Fulfillment IDs can be there for an order? We just got a single location ATM. All our orders are dispatched from our head office warehouse. So, does that mean i can expect the same fulfillment ID for all the lines in a particular order? If not, then what's the condition for having multiple fulfillment IDs
So in a nutshell here is what we are going to do.
a) Call the Admin API get order to get all the orders.
b) From the response, extract the order IDs.
c) call the Admin API GET fulfillment_orders to get the fulfillment ID for each order.
d) As the fulfillment ID is same for all the lines in an order, extract the fulfillment ID of the first line_item and save it against the order in our DB.
e) Once we dispatch the order, call the /admin/api/2023-01/fulfillments.json POST to create the fulfillment.
4)Can we call the Fulfillment API on the Same Fulfillment ID with Different Line numbers if we are Dispatching the line_items separately ? Like post the fulfillment for the first 3 items from the same order and fulfillment ID first with the tracking details. Then call the API with same fulfillmentID and orderNo, but with the rest of the line nos and tracking details.
Sorry, I know the post is a but long But i just wanted to be 100% sure that We are following the correct approach.
Hey There,
It's pretty well documented on how to go about this in the migration guide but if it was all a TLDR; then here is the short version using the rest api 🙂
1) query the order/[orderid]/fulfillment_orders.json
- this will give you all fulfillment orders for this order in all statuses. you are probably only interested in the ones that are open and for the location you are interested in.
2) use the fulfillments.json endpoint to create the fulfillment for the fulfillment order you got in step 1. Note that the structure of the json you send to the new fulfillment endpoint is different. Refer to the code examples to get the right data.
Cheers and happy coding
Gary