What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Track number is not always received via order webhook

Track number is not always received via order webhook

Louise_Elmose_H
Shopify Partner
78 2 21

Hi,

I have registered all of the order webhooks.

I want to save the order track number in my app. I find the value in each fulfillment on the order from the tracking_number field, but only if the tracking_company has a certain value.

This works in some cases, but in other cases I have no track value in the app, but when I look at the order in Shopify, the track number is there. Any suggestions as to why I can only extract the track number for some, but not all orders?

Thanks,

-Louise

 

Replies 2 (2)

Louise_Elmose_H
Shopify Partner
78 2 21

Update:

I have a concrete example for a given order id.

I can see all webhook updates in my log - in the most recent webhook update there is no track number or company. When I look at the order in Shopify, the track number is there, and when I use postman to fetch the given order from Shopify, the track number and company is there.

So there is a difference in the fields received on an order via webhook, or via querying the API for the order directly.

That must be a bug!?

Louise_Elmose_H
Shopify Partner
78 2 21

Second update:

So I guess I need to register the fulfillment webhook - assuming that it will call my app with the track number.

But it is really inconvenient because I still need the order webhooks for other data. As a fulfillment change will probably result in both an order and fulfillment webhook being called at the same time, this can lead to database update errors in my app, when updates are attempted at the same time. One webhook update will be rejected, but Shopify will keep calling until it succeeds, so the update will happen later. But then there is a race between the two webhooks - the order webhook has incorrect data in the track number field, the fulfillment webhook (hopefully) has the correct track number.

It would be really nice if Shopify would determine whether it is a bug or not that the order webhook does not have valid track numbers / or alternatively that the order webhook is not called when only the track number changes on an order.