Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: How to retrieve Fulfillment Order ID

Solved

How to retrieve Fulfillment Order ID

devserge
Shopify Partner
4 2 4

Hey there,

 

I am curently working on an integration for one of our clients and we are trying the new 2023-04 API.

 

We need to fulfill an specific order. We use an post request to /admin/api/2023-04/fulfillments.json.  In that post request, we have this line:

    "line_items_by_fulfillment_order": [
      {
        "fulfillment_order_id": ###########
      }
    ]

 

 

That fulfillment_order_id is not the ID of the order. It is the ID of the fulfilment, but which fulfillment? I am trying to create one, so how can I have an id?

 

In the portal, when i want to fullfill an order, it redirects me to a page where I can select the products, fill in the tracking information and more. In the URL, we have /orders/####/fulfillment_orders/###/fulfill?locationId=###. In that url, we have the fulfilment ID after the /fulfillmen_orders/. When I am using that id, everyting works. But how to get that ID with the API?

 

Any suggestions?

 

Thanks in advance!

Accepted Solution (1)

devserge
Shopify Partner
4 2 4

This is an accepted solution.

For everyone wondering, I fixed it. There is a difference between fulfillment belonging to an order, and fulfilment_orders from an order. There always is an fulfillment_order_id that you can lookup with this endpoint:

 

https://store.myshopify.com/admin/api/2023-04/orders/{orderid}/fulfillment_orders.json

 

With that endpoint, you can retrieve the fulfilment_order_id that you can use for the fulfillment endpoint to create a new fulfillment with the order data, tracking number and more.

View solution in original post

Replies 4 (4)

devserge
Shopify Partner
4 2 4

This is an accepted solution.

For everyone wondering, I fixed it. There is a difference between fulfillment belonging to an order, and fulfilment_orders from an order. There always is an fulfillment_order_id that you can lookup with this endpoint:

 

https://store.myshopify.com/admin/api/2023-04/orders/{orderid}/fulfillment_orders.json

 

With that endpoint, you can retrieve the fulfilment_order_id that you can use for the fulfillment endpoint to create a new fulfillment with the order data, tracking number and more.

tomaspasqualini
New Member
7 0 0

Hey Devserge, I have the same need as you. I tried your solution but for some reason I get an empty object "fulfillment_orders": []

 
In the Order > Fulfill link for a specific order, I see there is indeed a fulfillment_order ID = 6602265657600
URL ends in : /orders/5526506176768/fulfillment_orders/6602265657600/fulfill?locationId=33563213933
 
And in my endpoint/request I use this same Order ID:
/admin/api/2023-04/orders/5526506176768/fulfillment_orders.json
 
Any idea of why might this be happening? Thanks!
lucas198
Shopify Partner
1 0 1

Hi Tomaspasqualini, i am using this one to get the 

fulfillment_order_id: https://{{API_key}}:{{admin_API_access_token}}@{{shop}}/admin/api/{{api-version}}/orders/{{order_id}}//fulfillment_orders.json

and then i use this one to actually fulfill the order:
https://{{API_key}}:{{admin_API_access_token}}@{{shop}}/admin/api/{{api-version}}/fulfillments.json
with this json as body:
{
    "fulfillment":
    {
        "line_items_by_fulfillment_order":
        [
            {
                "fulfillment_order_id":6602265657600
            }
        ],
        "notify_customer": true,
        "tracking_info":
        {
            "number":"MS1562678",
        }
    }
}
calvinding
Visitor
1 0 0

企业微信截图_60e2f697-ca5e-40c3-849b-e1bd049df2c1.png