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: Simple API flow to fulfill using Fulfillment Orders - how to?

Solved

Simple API flow to fulfill using Fulfillment Orders - how to?

Mads_W
Excursionist
16 2 14

We are ERP system developers and made integration using the old fulfillment.json endpoint, where we only do complete fulfillments.

Now we need to be able to handle partial fulfillments, and want to move to the new fulfillment_orders.json endpoint. 

I cant figure out the documentation for the simple flow we want to do.

We want this simple flow:

  1. Order is created in Shopify
  2. Order is imported to ERP
  3. ERP do complete or partial fulfillment and capture
    1. Once rest of products are ready to ship a complete or partial fulfillment is done again. Step 3 and 3.1 are repeated until order is complete

I get data on the order on fulfillment_orders endpoint after creation of the shopify order:

"id"5867286823165,
            "shop_id"64805961981,
            "order_id"4803980919037,
            "assigned_location_id"69589598461,
            "request_status""unsubmitted",
            "status""open",
            "supported_actions": [
                "create_fulfillment",
                "hold"
 
  1. How to call, if we should fulfill the whole order now?
  2. How to call, if we needed only partial fulfillment?
    1. And how to fulfill rest afterwards?

Thanks!

Accepted Solution (1)

Mads_W
Excursionist
16 2 14

This is an accepted solution.

We seemed to get our head around it. First problem was that we got empty response on ..../orders/<orderid>/fulfillment_orders.json. 

 

We got this flow working now:

  1. GET ...orders/(ordreid)/fulfillment_orders.json to see fulfillmentorder to handle, copy id of fulfillment order and the id of the lines
  2. POST .../fulfillments.json with a body of something like this 

        "fulfillment": {

            "message": "The package was shipped this morning." 

            "notify_customer": false,

            "tracking_info": {

                "number": 112233,

                "url": https://www.dr.dk,

                "company": "Danmarks Radio shipping"

            },

            "line_items_by_fulfillment_order": [

                {

                    "fulfillment_order_id": <id from get in 1>,

                    "fulfillment_order_line_items": [

                        {

                            "id": <line id from 1>,

                            "quantity": 8

                        },

                        {

                            "id": <lineid from 1>,

                            "quantity": 5

                        }

                    ]

                }

 

 

If you are struggling with empty array response on GET ..../fulfillment_orders.json, try updating permissions or creating a new private app.

View solution in original post

Replies 6 (6)

Mads_W
Excursionist
16 2 14

This is an accepted solution.

We seemed to get our head around it. First problem was that we got empty response on ..../orders/<orderid>/fulfillment_orders.json. 

 

We got this flow working now:

  1. GET ...orders/(ordreid)/fulfillment_orders.json to see fulfillmentorder to handle, copy id of fulfillment order and the id of the lines
  2. POST .../fulfillments.json with a body of something like this 

        "fulfillment": {

            "message": "The package was shipped this morning." 

            "notify_customer": false,

            "tracking_info": {

                "number": 112233,

                "url": https://www.dr.dk,

                "company": "Danmarks Radio shipping"

            },

            "line_items_by_fulfillment_order": [

                {

                    "fulfillment_order_id": <id from get in 1>,

                    "fulfillment_order_line_items": [

                        {

                            "id": <line id from 1>,

                            "quantity": 8

                        },

                        {

                            "id": <lineid from 1>,

                            "quantity": 5

                        }

                    ]

                }

 

 

If you are struggling with empty array response on GET ..../fulfillment_orders.json, try updating permissions or creating a new private app.

Matthias7
Excursionist
30 3 3

Thank you very much for following up on the question and posting your solution! 
It was very helpful

 

Cheers,

Matthias

moin786ahamad
Shopify Partner
3 0 4

Hey Mads_W,

I'm also facing issues in creating fulfillment for an order using REST API service, as of now my current configuration for Orders is 'mark order as un-fulfilled initially'. Can you please share the endpoint and process that you're following now to achieve this as per api version 2023-01.

Thanks

Thanks & Regards
Moin Ahamad
Salesforce Developer
Cosmekarn
Shopify Partner
4 0 0

Did you found any solution for that ?

Matthias7
Excursionist
30 3 3

Hey Cosmekarn,

 

maybe I can help, we have order-fulfilments running with api version "2023-04", what problem exactly are you facing? 


cheers,

Matthias

Su99
Visitor
1 0 0

Hello @Matthias7 I need your help on shopfiy order fulfillment:

POST: admin/api/2024-04/orders/5868592857384/fulfillments.json

Body:

{
"fulfillment": {
"message": "The package was shipped this morning.",
"notify_customer": false,
"location_id": 89816072488,
"tracking_info": {
"number": 112233,
"company": "Other"
},
"line_items_by_fulfillment_order": [
{
"fulfillment_order_id": 6835502350632,
"fulfillment_order_line_items": [
{
"id": 15251424149800
}
]

}
]
}
}

I'm using correct ID I have checked multiple time.

Response:
{
"fulfillments": []
}