Add multiple fulfillments

Solved
Highlighted
Excursionist
23 2 6

Hello,

 

I am working at adding fulfillment to my shopify order, and I have it works to add a fulfillment per line item per request. I wonder if I can add multiple fulfilments per request using either Restful API or GraphQL. Please advice. I greatly appreciate it.

 

Thanks!

0 Likes
Highlighted
Shopify Staff
Shopify Staff
51 10 5

Using both GraphQL and REST Admin APIs you are able to create one fulfillment at a time per query / request. You are able to however fulfill more than one line item on an order with a single request given that these variants have the same location ID. See the REST Admin API example below:

 

POST /admin/api/2019-10/orders/#{order_id}/fulfillments.json
{
  "fulfillment": {
    "location_id": 905684977,
    "tracking_number": null,
    "line_items": [
      {
        "id": 466157049
      },
      {
        "id": 518995019
      },
      {
        "id": 703073504
      }
    ]
  }
}

https://help.shopify.com/en/api/reference/shipping-and-fulfillment/fulfillment#create-2019-10

 

Would you be able to provide some more details about your use case such that we can potentially offer more guidance?

 

Cheers

0 Likes
Highlighted
Excursionist
23 2 6

@sd_ wrote:

Using both GraphQL and REST Admin APIs you are able to create one fulfillment at a time per query / request. You are able to however fulfill more than one line item on an order with a single request given that these variants have the same location ID. See the REST Admin API example below:

 

POST /admin/api/2019-10/orders/#{order_id}/fulfillments.json
{
  "fulfillment": {
    "location_id": 905684977,
    "tracking_number": null,
    "line_items": [
      {
        "id": 466157049
      },
      {
        "id": 518995019
      },
      {
        "id": 703073504
      }
    ]
  }
}

https://help.shopify.com/en/api/reference/shipping-and-fulfillment/fulfillment#create-2019-10

 

Would you be able to provide some more details about your use case such that we can potentially offer more guidance?

 

Cheers


Thanks for your reply sd_!

Let say I have 100 orders , which make at least 100 line items. To create  fulfillments for all of those orders, I have to  loop through all orders and send requests (either REST Admin or GraphQL) to create fulfillments for those line items. Number of request is 100, which make the code run for a long time because there is a limit to send request to either APIs. What I want to achive is to send one request or a few requests to create fulfillments for those line items. Is it possible?

0 Likes
Highlighted
Shopify Staff
Shopify Staff
51 10 5

This is an accepted solution.

It is not possible to fulfill multiple orders with a single request. You must make a request per order that you are trying to fulfill.

1 Like
Highlighted
New Member
2 0 0

But you are able to fulfill multiple items within an order at the same time, right? And assuming each item shipped individually, you are able to apply several tracking numbers within the fulfillment? However, the issue we're coming across is that we've been unable to "assign" each tracking number to a particular line item. Because, in the fulfillment event, we are passing through the sequence of line items, and separately, the sequence of tracking numbers, so we might assume that those tracking numbers are "assigned" to each line item in the corresponding sequence (tracking number 1 gets assigned to line item 1, tracking number 2 gets assigned to line item 2, etc.). But that's not the case. So is there any way to structure the JSON for the fulfillment event such that we're able to assign specific tracking numbers to specific line items in the order?

0 Likes
Highlighted
Shopify Staff
Shopify Staff
51 10 5

Hi There, 

 

Our fulfillments documentation states the following: 

 

"Each fulfillment supports a single tracking number. If you need to use multiple tracking numbers, then you should create separate fulfillments." 

 

Accordingly if you need different tracking numbers for different line items, you should be creating separate fulfillments for these line items. You are able to have multiple fulfillments for any order. 

 

Cheers

0 Likes
Highlighted
Shopify Expert
4188 29 410

This does not apparently work as you expect.

 

I have one order, with two line items to fulfill. I therefore have one fulfillment order ID to get started. I get two tracking numbers from the fulfillment center for the order.

 

So I create a single fulfillment via the GraphQL call fulfillmentCreateV2 using the fulfillment order ID and the tracking number. What happens there is the whole order is fulfilled in that one call. So adding a second tracking number is now not possible.

 

So how do we do that. I was told the first fulfillment order would be closed, so I had to open a second fulfillment order to assign the second tracking number to the second line item... that does not work.

 

So when we are not given the line item IDs, but we have > 1 tracking number to assign, what are we supposed to do?

 

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
Highlighted
Excursionist
23 2 6
Hi HunkyBill,

I believe you can do the followings:

1. You need to get the line item ID(s) for each order ID
2. Send the fulfillmentCreat request for each line item id

It should work. Hope it help
0 Likes
Highlighted
Shopify Expert
4188 29 410

I don't have the line item ID's

 

The problem is Amazon and other sales channels cannot even squarely map Shopify SKUs never mind Line Item IDs. So I get tracking numbers, and an order name. Make due!

 

I believe my approach has to be. Query the order for a fulfillment order ID with status OPEN. Add a tracking number to that. Repeat.

 

I should get two fulfillment order IDs, and each represents a fulfillment with a tracking number. Never mind that the two issued tracking numbers won't match the actual line item... it will still be the customer getting two packages, with two tracking numbers...

 

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
Highlighted
Excursionist
23 2 6

I guess in your case, you can still get the fulfillment ID using SKU/variant ID so that you can find exactly fulfillment ID for each line item in case an order has multiple line items, then move forward from there.

0 Likes