Re: Fulfillment Rest API Multiple Tracking Numbers

Fulfillment Rest API Multiple Tracking Numbers

merejsoft
Tourist
7 0 1

Trying to convert from the deprecated way of adding tracking numbers to an order. So fulfillments REST API here we go.

 

I can successfully make a fulfillment with single tracking number / url. When reviewing the response, there is tracking_number and also tracking_numbers. Same for url and also urls.

 

How do I pass multiple tracking numbers at once? My hope was below but it does not work. Why do I need this capability that we had with the "now being deprecated" process.

 

1.  We have customers that order a single product and due to restrictions from UPS/FedEx box sizes, we ship those products in multiple boxes. So on a single order with one line item and a quantity of 1, I need to pass multiple tracking numbers. We have no work around for this because as soon as I assign the one tracking number for item 1, the fulfillment is closed and I can't call API again to add an additional tracking number. Nor would I want to because I don't want our customer receiving 3 emails for a single product they bought.

 

2. We have customers that order multiple products on a single order. We ship all those products at once, we want to have shopify send one email with 5 tracking numbers of the 5 products that shipped at the same time. If I call the fulfillment API 5 times with one tracking number for item one, then one tracking number for item 2, etc, our customers will receive 5 emails with 5 separate tracking numbers. As a consumer, that would be really annoying.

 

I've seen similar posts with no good answers. Older posts all say to use the "now being deprecated" process. Huge issue with less than 60 days to solve.

 

{
    "fulfillment": {
        "notify_customer"true,
        "tracking_info": {
            "numbers": [
                "394061616238"
                ,"394061616239"
            ],
            "company""FedEx"
        },
        "line_items_by_fulfillment_order": [{
                "fulfillment_order_id"5781701361752
            }
        ]
    }
}
Replies 9 (9)

ShopifyDevSup
Shopify Staff
1453 238 512

Hi @merejsoft 👋

 

In GraphQL, you can use the `fulfillmentCreateV2` mutation to include multiple tracking numbers on a single fulfillment and specify notifying the customer as needed.

 

Hope that helps!

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

mp-cargo
Tourist
8 0 2

I understand that GraphQL offers it but can it be done also via Rest Admin API?

merejsoft
Tourist
7 0 1

I received this answer already. The answer was no. It's not available via Rest Admin API. It seems like they are moving away from Rest in favor of GraphQL since GraphQL is less taxing on their systems.

Vach
New Member
5 0 0

Is the same problem actual still? Do we need multiple requests for a multiple Tracking Numbers sill?

Read my articles on https://vachmir.medium.com/

ShopifyDevSup
Shopify Staff
1453 238 512

Hi @Vach 👋

 

You should only need to make a single request with `fulfillmentCreateV2` or `fulfillmentTrackingInfoUpdateV2` mutation to include multiple tracking numbers on a single fulfillment. In REST, each fulfillment supports a single tracking number, so separate fulfillment must be created to support multiple tracking numbers.

 

Hope that helps!

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

Vach
New Member
5 0 0

Are the `fulfillmentCreateV2` and `fulfillmentTrackingInfoUpdateV2` technologies for GraphQL?

Read my articles on https://vachmir.medium.com/
ShopifyDevSup
Shopify Staff
1453 238 512

That's exactly right, @Vach!

 

Both `fulfillmentCreateV2` and `fulfillmentTrackingInfoUpdateV2` are Admin GraphQL mutations, and both docs have examples for using each mutation to add 2 tracking numbers:

 

- Use `fulfillmentCreateV2` to fulfill a fulfillment order with two tracking numbers

- Use `fulfillmentTrackingInfoUpdateV2` to add tracking information with two tracking numbers

 

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

Vach
New Member
5 0 0

I could send more than 1 Tracking numbers to the Shopify order. Thank You for your help. But now I want to have a partial fulfillment containing multiple tracking numbers.

I try to "merge" these 2 principles

https://shopify.dev/docs/api/admin-graphql/2023-04/mutations/fulfillmentCreateV2#examples-Partially_...

 

https://shopify.dev/docs/api/admin-graphql/2023-04/mutations/fulfillmentCreateV2#examples-Fulfill_a_...

 

Is it possible to have a Partial Fulfillment which contains 2 or more tracking numbers? I will have 2 or more Partial Fulfillment. I just have a fear that Shopify does not support this.

Read my articles on https://vachmir.medium.com/
matt-cos
Shopify Partner
2 0 0

Hey @Vach, not sure if you're still looking for an answer, but yes it is possible:

 

Mutation:

mutation fulfillmentCreateV2($fulfillment: FulfillmentV2Input!) {
  fulfillmentCreateV2(fulfillment: $fulfillment) {
    fulfillment {
      id
      status
      trackingInfo(first: 10) {
        company
        number
        url
      }
    }
    userErrors {
      field
      message
    }
  }
}

 

 Variables:

{
  "fulfillment": {
    "lineItemsByFulfillmentOrder": {
      "fulfillmentOrderId": "gid://shopify/FulfillmentOrder/6847129059624",
      "fulfillmentOrderLineItems": {
        "id": "gid://shopify/FulfillmentOrderLineItem/15274072244520",
        "quantity": 1
      }
    },
    "trackingInfo": {
      "company": "UPS",
      "numbers": [
        "1Z001985YW99744790",
        "1Z001985YW99744791"
      ]
    }
  }
}