Solved

Add multiple fulfillments

homiebe
Excursionist
23 2 7

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!

Accepted Solution (1)
sd_
Shopify Staff (Retired)
51 10 7

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.

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 12 (12)

sd_
Shopify Staff (Retired)
51 10 7

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

To learn more visit the Shopify Help Center or the Community Blog.

homiebe
Excursionist
23 2 7

@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?

sd_
Shopify Staff (Retired)
51 10 7

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.

To learn more visit the Shopify Help Center or the Community Blog.

dekalb
Tourist
7 0 1

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?

sd_
Shopify Staff (Retired)
51 10 7

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

To learn more visit the Shopify Help Center or the Community Blog.

HunkyBill
Shopify Expert
4851 60 554

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
homiebe
Excursionist
23 2 7
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
HunkyBill
Shopify Expert
4851 60 554

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
homiebe
Excursionist
23 2 7

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.

HunkyBill
Shopify Expert
4851 60 554

When you first get an order, it has no fulfillments. So getting the fulfillment is not a challenge, since there are none. Making that first fulfillment of two, would indeed add a fulfillment entry to the fulfillment order that was used, however in my case, by not specifying the exact line item ID, that would be a random assignment I guess, by the Shopify machine.

 

Once the second fulfillment was added, I would expect to see two fulfillment orders, with one fulfillment each.

 

Fulfillment is not simple. Nope. For those venturing beyond the simpleton single t-shirt model... it's quite the journey.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
moiranoiseux
Visitor
1 0 0

Hi there- is this still the case? 
We are filling grocery orders that often require 2 boxes- can Shopify support more than one tracking number per order? (we are not fulfilling manually, it's syncing from the 3PL software, Logiwa)  Thank you!

HunkyBill
Shopify Expert
4851 60 554

Shopify does support more than one tracking number per order. Just ensure you create fulfillments for each tracking number. Obviously, between the old and now deprecated fulfillments and the new fulfillment order methodology, you are faced with a learning curve.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com