Solved

I don't get it. :( migration to fulfillment orders

Patrick_V
Visitor
2 0 0

I don't make any progress here. 🙁

I'm helping a friend with his shop.

Until now, only two API calls were used:

 

GET orders.json?status=open&financial_status=paid&fulfillment_status=unshipped

to retrieve the orders, and:

POST fulfillments.json

like:

{
  "fulfillment": {
  "location_id": 1122334455,
  "tracking_number": "123456789",
  "tracking_url": "https://carrier.com/track=123456789",
  "tracking_company": "Superfast",
  "notify_customer": true
 }
}

to mark it as shipped/done. And that was it.

 

What is the easiest way to accomplish this with the new "fulfillment orders" that must be migrated to?

Thanks for your help in advance.

Accepted Solution (1)

garyrgilbert
Shopify Partner
388 40 159

This is an accepted solution.

Hi Patrick,

 

Its not too much more difficult 🙂

 

1) get orders/{order_id}/fulfillment_orders.json?status=open =>this returns an array

2) from the above get the fulfillment order ID of the fulfillment in question and optionally the line_items to fulfill

3) create the new fulfillment structure found here

 make sure in the above structure that fulfillment_order_id = the id from step 2 and not the actual order id, make sure if you include the line_items array that you always have a non-zero value for quantity, and that its not greater than the fulfillable_quantity value (or you will get an error). If you are always fulfilling all line_items you can omit fulfillment_order_line_items.

4) post it /admin/api/2023-01/fulfillments.json

5) do a happy dance cause you are done.

 

Cheers,

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution

View solution in original post

Replies 7 (7)

garyrgilbert
Shopify Partner
388 40 159

This is an accepted solution.

Hi Patrick,

 

Its not too much more difficult 🙂

 

1) get orders/{order_id}/fulfillment_orders.json?status=open =>this returns an array

2) from the above get the fulfillment order ID of the fulfillment in question and optionally the line_items to fulfill

3) create the new fulfillment structure found here

 make sure in the above structure that fulfillment_order_id = the id from step 2 and not the actual order id, make sure if you include the line_items array that you always have a non-zero value for quantity, and that its not greater than the fulfillable_quantity value (or you will get an error). If you are always fulfilling all line_items you can omit fulfillment_order_line_items.

4) post it /admin/api/2023-01/fulfillments.json

5) do a happy dance cause you are done.

 

Cheers,

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
deepakrawat
Shopify Partner
11 0 0

hey Gary

we are using this endpoint 

[POST]  /admin/api/2021-10/orders/OrderId/fulfillments.json
 
What are the changes required to create a fulfillment using the new fulfillmentOrder endpoint?
 
Software Developer @ TPSTECH.in
garyrgilbert
Shopify Partner
388 40 159

Hi there Deepak,

 

Well firstly you will need to change the api version to at least 2022-10.

 

Then follow the steps I listed above, and visit (read) the links in the above post.

 

cheers,

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Patrick_V
Visitor
2 0 0

Thanks a lot for your Gary, this has worked so far. 👍

I still wonder about "Step 3" described here, that it's necessary to opt-in to fulfillment orders and provide a callback URL.

https://shopify.dev/docs/apps/fulfillment/migrate

Do I even need this or can I just omit it?

 

garyrgilbert
Shopify Partner
388 40 159

Hi Patrick,

 

no you can omit that if you are not building a fulfillment service app.

 

Cheers,

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
CubiGear
Shopify Partner
31 3 7

Despite doing exactly that with api version 2023-07 and I triple checked every single value, I receive the below error.  Any idea what I'm doing wrong ?

422 Unprocessable Entity

 

CubiGear
Shopify Partner
31 3 7

I found the issue.  I was getting all fulfillment_orders including the closed one.  Added to the creation of a fulfillment was giving me this issue.  To solve it, I filter the open fulfillment_orders only.

It's just sad that this is the kind of error we received rather than a proper message saying that we're trying to fulfill a closed one.