Solved

Fulfillment order line item does not exist. - But it does and I am using line_item_id?

Mowtine
Tourist
7 2 0

I am trying to fulfil an order with the API. 

I get the fulfillment_orders for the order:

 

{
"fulfillment_orders": [
        {
"id": 5162433085613,
"shop_id": 59711815853,
"order_id": 4183684907181,
            ...
"supported_actions": [
"create_fulfillment",
"hold"
            ],
"destination": null,
"line_items": [
                {
"id": 10909262577837,
"shop_id": 59711815853,
"fulfillment_order_id": 5162433085613,
"quantity": 1,
"line_item_id": 10763713675437,
"inventory_item_id": 43141097849005,
"fulfillable_quantity": 1,
"variant_id": 41044827701421
                }
            ],
"fulfill_at": null,
            ...
        }
    ]
}

 

and I use the id for the fulfilment and line_item_id for id for line item:

 

{"fulfillment":{"message":"MSG","notify_customer":true,
"tracking_info": {"number": 1562678,"url": "https://www.my-shipping-company.com","company": "my-shipping-company"},
    "line_items_by_fulfillment_order":[
{"fulfillment_order_id":5162433085613,
"fulfillment_order_line_items":[
    {"id":10763713675437,
    "quantity":1}
]}]}}​

but when posting that I get: 

 

"Fulfillment order line item does not exist."
What am I doing wrong here?
 
Thanks. 
Accepted Solution (1)

Mowtine
Tourist
7 2 0

This is an accepted solution.

Found the problem. The tutorial at: https://shopify.dev/apps/fulfillment/order-management-apps is INCORRECT.

You can't use: https://{shop}.myshopify.com/admin/api/2021-10/fulfillments.json

You must use: https://{shop}.myshopify.com/admin/api/2021-10/orders/<number>/fulfillments.json

to fulfil an order.

View solution in original post

Replies 10 (10)

Mowtine
Tourist
7 2 0

This is an accepted solution.

Found the problem. The tutorial at: https://shopify.dev/apps/fulfillment/order-management-apps is INCORRECT.

You can't use: https://{shop}.myshopify.com/admin/api/2021-10/fulfillments.json

You must use: https://{shop}.myshopify.com/admin/api/2021-10/orders/<number>/fulfillments.json

to fulfil an order.

kolalok
Visitor
1 0 3

I believe I found another way to get rid of this error so I mention it here in case it helps someone else.

 

The documentation is not entirely clear in what exactly should be entered as the "line item ID".

We need to be aware that:

  • orders (those created by shop customers) have line items, identified by line_item_id in your listing
  • fulfillment orders have their own line items, identified by just id here (10909262577837 in your example), usually corresponding to the order's line items

Surprisingly, the latter is correct when creating a fulfillment using the /fulfillments.json endpoint.

So maybe the tutorial is correct after all, it's only confusing.

Gokhale_Method
Shopify Partner
3 0 6

I too figured this out but the hard way (debugging), the documentation really needs to improve, the line item id is not the line item id of the order but the fulfillment order have ther own line items and that is the id which is expected.

 

Small suggestion for all developers.

1) Retrieve the fulfillment order using order api

2) Loop the line_items of the fulfillment order and compare the line_item id with the one you want to fill

3) Once identified use the id of that element as the line_item_id in the request for fulfillment_order_line_items

 

Thanks,

Sadashiv.

 

Thanks,

Sadashiv.

AndrewPotts
Shopify Partner
3 0 0

Thank you. This was driving me nuts.

hubtrotter
New Member
6 0 0

Hello,
I'm trying to fulfill an item from a multi-piece order based on "requires_shipping: false" or the fact that is a digital product, the other items would get fulfilled from an integration with our WMS when fulfilled.
Is there an endpoint you would recommend to accomplish this ask? 

ShopifyDevSup
Shopify Staff
1299 210 451

Hey @hubtrotter , for visibility, I've answered this over on your other post here

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

colleenc
Shopify Partner
82 7 20

I had the same problem, and the solution is to remove "fulfillment_order_" from in front of line_items. See below:

 

{
"fulfillment": {
"line_items_by_fulfillment_order": [{
"fulfillment_order_id": {api.id},
"line_items": [{Line Items Fulfillment Array}]
}],
"tracking_info": {
"company": "{Fulfillments: Tracking Company}",
"number": {Fulfillments: Tracking Number},
"url": "{Tracking URL}"
},
"notify_customer": false,
"location_id": {api.assigned_location_id}
}
}

Matthias7
Excursionist
30 3 3

My jaw is on the floor that this is a valid fix
happy accident or genius?!?! 
Thank you regardless 🙂

SebastianH
Shopify Partner
2 0 11

works syntactically but fulfills all items of an order. However, to be precise, fulfillment_order_line_items should be used.

Dr. Sebastian Herden | Founder @ Y-Core Invest
PhD in computer science “model driven configuration management” | digital marketer, eCommerce owner, author and speaker

iftekhar1011
Visitor
1 0 0

By calling this API : https://shopify.dev/docs/api/admin-rest/2023-04/resources/fulfillmentorder#get-fulfillment-orders-fu...
with the order_id you will get a object and also with line item array.
Here you will found a id of line item . 
That is need to use to update the fulfillment for specific line item.

iftekhar1011_0-1710569923084.png