How do I fulfill a single line item in a fulfillment order without closing the order?

sitver
Shopify Partner
1 0 0

I want to fulfill one line item from a multi-item fulfillment order without closing the whole fulfillment order. The documentation implies I can do this by sending  'fulfillment_order_line_items' with a 1-item array of the item I want to fulfill, but when I do that, it closes the whole fulfillment order, returning an error when I try to fulfill other items from the fulfillment order.

 

What am I doing wrong and how do I accomplish what I'm trying to accomplish?

 

The specific request I'm sending:

 

axios.post(

/// Optionss:: line_items_by_fulfillment_order (Arr), message (optional), notify_customer (boolean defaulting to false)

base_url + '/admin/api/2023-04/fulfillments.json', 

 {

'fulfillment': {

message: "The message we're sending",

'line_items_by_fulfillment_order': [

 {

'fulfillment_order_id': fulfillment_order_id,

'fulfillment_order_line_items': [{'id': <item_id>, 'quantity': 1}]

 }

 ]

 }

 },

 { headers: { 'X-Shopify-Access-Token': <our_auth_token>, 'Content-Type': 'application/json' } }

 )
 

 

Reply 1 (1)

Liam
Shopify Staff
2731 299 769

HI Sitver,

 

The fulfillment request you're seems to be correct according to Shopify's GraphQL Admin API documentation. However, it is worth noting that Shopify treats each fulfillment_order_line_items array as a separate fulfillment request.

 

If a fulfillment order has multiple items and only some of them are moved in a request, then a new fulfillment_order is created for the remaining items that were not moved. The status of this new fulfillment_order is open.

 

So, if you're trying to fulfill another item from the original fulfillment_order after creating a partial fulfillment, you might be getting an error because that original fulfillment_order is now considered closed.

 

Instead, you should be able to fulfill the remaining items from the newly created fulfillment_order. Check the response of your initial partial fulfillment request to get the ID of the new fulfillment_order and use that for your next fulfillment request.

 

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