Create Fulfillment returning 422 - Fulfillment order line item does not exist

Solved
ItalianGourme
Tourist
7 0 2

Hello,

 

I am working on an update of our fulfillment notification system.

Currently the system does work correctly if i do not include any details for fulfillment_order_line_items (as this information is optional).

 

I want to be able to actually specify the details and, based on the documentation, i have to fill the array with a pair of "id" and "quantity" where the id would be the fulfillment_order_line_item ID.

 

If i include the above mentioned infos, the call fails returning a 422 error code.

The reason given in the response is "Fulfillment order line item does not exist".

It does not specify "which one" even if there is more than one specified in my call.

Also i double checked and all the line-id provided in the call DO exist.

It is either bugged or i am missing something basic.

 

here is the json of the call (in this case with only a single line for easier read):

 

{
    "fulfillment": {
        "line_items_by_fulfillment_order": [{
                "fulfillment_order_id": 6427333493026,
                "fulfillment_order_line_items": [{
                        "id": 14106578878754,
                        "quantity": 1
                    }
                ]
            }
        ],
        "notify_customer": false,
        "tracking_info": {
            "company": "DHL",
            "number": "123123123",
            "url": "https://nolp.dhl.de/nextt-online-public/en/search?piececode=123123123"
        }
    }
}

and here, for checking purposes, the fulfillment_orders json for the order(non relevant section abbreviated in ...):

 

{
    "fulfillment_orders": [{
            "assigned_location": {
                ...
            },
            "assigned_location_id": 62131109993,
            "delivery_method": {
                ...
            },
            "destination": {
                ...
            },
            "fulfill_at": "2023-10-09T21:00:00+02:00",
            "fulfill_by": null,
            "fulfillment_holds": [],
            "id": 6427333493026,
            "international_duties": {
                "incoterm": null
            },
            "line_items": [{
                    "fulfillable_quantity": 1,
                    "fulfillment_order_id": 6427333493026,
                    "id": 14246608306466,
                    "inventory_item_id": 42350142586985,
                    "line_item_id": 14106578878754,
                    "quantity": 1,
                    "shop_id": XXXXXX,
                    "variant_id": 40252562276457
                }
            ],
            "merchant_requests": [],
            "order_id": XXXXXX,
            "request_status": "unsubmitted",
            "shop_id": XXXXXX,
            "status": "open",
            "supported_actions": ["create_fulfillment", "hold"]
        }
    ]
}

The personal data has been replaced with "XXXXXX".

As you can check the fulfillment_order 6427333493026 does have a line_item_id 14106578878754 .
So if the error actually refers to the fact the line_item_id does not exist it could be some kind of bug.

Or, as stated above, i am missing something basic / obvious.

 

Any help is greatly appreciated.

P.S. It is obvious that for the specific (simple) example provided not including the array would work out, but i need to be able to specify what was fulfilled to handle both "multi shipping" cases and "partial fulfillment".

Accepted Solution (1)
Liam
Shopify Staff
Shopify Staff
1837 190 566

This is an accepted solution.

Hi ItalianGourme,

From your message, it seems like you're sending the correct data in your request. A 422 error typically means that the server understood your request, but it's refusing to process it because it might be malformed or in violation of business rules.

 

Looking at your request, I see that you're using line_item_id in your fulfillment_order_line_items array, but you might need to be using the ID of the fulfillment order line item, not the line item ID. There's another forum post here that seems to be similar and when they used the ID of the fulfillment order line item, rather than the the line item id of the order it was resolved for them.

 

Please use the fulfillment order line item as 14246608306466 and try again - hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me 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

View solution in original post

Replies 3 (3)
Liam
Shopify Staff
Shopify Staff
1837 190 566

This is an accepted solution.

Hi ItalianGourme,

From your message, it seems like you're sending the correct data in your request. A 422 error typically means that the server understood your request, but it's refusing to process it because it might be malformed or in violation of business rules.

 

Looking at your request, I see that you're using line_item_id in your fulfillment_order_line_items array, but you might need to be using the ID of the fulfillment order line item, not the line item ID. There's another forum post here that seems to be similar and when they used the ID of the fulfillment order line item, rather than the the line item id of the order it was resolved for them.

 

Please use the fulfillment order line item as 14246608306466 and try again - hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me 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

ItalianGourme
Tourist
7 0 2

Hello,

 

I was under the assumption that, the " fulfillment order line item ID" was the one stated under fulfillment_orders->line_items->line_item_id.

 

If this is not the case, could you tell me where i can get the "fulfillment order line item ID" information?

Thanks in advance

 

Edit: did not read your reply properly, it is actually under "id".

That makes much sense, will try it and if it works(most likely does) will accept as solution.

Edit2: working fine as expected. Had to use id as suggested. Marked as solved

Liam
Shopify Staff
Shopify Staff
1837 190 566

Great to hear it's working for you now!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me 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