Querying order returns null if made immediately on thank you page

If you have a thank you page extension that queries the order data (calling fetch right after the thank you page extension is rendered), most likely the query will return null when you supply the order ID (gotten from orderConfirmation API).

It seems like Shopify will take 1-2 seconds to process the order on the backend after the thank you page is rendered. I was able to replicate this recently on my own test store (and also on production store of other merchants that gave me permission to test).

Currently the workaround would be to wait 1-2 seconds before querying the order on thank you page (using setTimeout), to ensure the order is properly populated on Shopify’s end first

This is correct. There may be a brief delay in which the full order is actually available for you to fetch. What are you trying to retrieve on the thank you page that is not already available to the UI extension?

Thanks for the confirmation, I would suggest informing about this delay in the documentation (for the thank you page extension) if possible.

It would save a lot of headache for developer and also merchant (for extension that shows UI depending on order data, which might not show the UI because the query returned null).

For my use case, I am trying to retrieve the tags of the products in the order. To check for if the order contains products that have certain tag, so that I can show specific UI.

@soulchild Thank you for the suggestion on improving our documentation. For your use case, could you read the cart lines from the UI extension API instead to identify the products purchased and use the storefront API to retrieve product tags for them?

@soulchild there was documentation about this when the TYP was first released.

But I agree, this is a huge downgrade in functionality compared to the legacy order status page.

For example, our application needs the customer ID, shipping address, cart lines, order ID, order tags to determine if a post-purchase verification is required or not.

In the past, this data was available synchronously when the order status page was displayed. This new Thank You page is just a shell, with an order confirmation number.

There have been several cases where merchants and customers are used to the older order status page, and expect our app to function exactly the way it used to. It takes so much time and energy to explain this is Shopify’s choice to present this new TYP that doesn’t immediately provide this data and there’s nothing we can do about it.

In our experience there can be a delay of even up to minutes, not just seconds. This is valuable time that a critical post-purchase component needs to display while the customers attention is on this transitory page.

We’ve even had Shopify’s own App Reviewers threaten to pull our app from the app store because of this. It’s really unfortunate that this new pattern was introduced.

I understand Shopify wants to provide some kind of immediate synchronous page, but this page lacks the details and functionality that allowed much richer experiences for apps to build.