Order Status page no longer includes the order_id

Hello,

Our app add functionality to the order status page (legacy, not customer extensions), and we’ve noticed that the window.Shopify object no longer seems to contain the order ID whatsoever.

This is critical for use to display a widget in the order status page that is associated with the customer’s order, without this we cannot display the correct details.

Before we could access it like so:

window.Shopify.checkout.order_id

But that has been silently removed now.

We’re trying to find an alternative, but even using the AJAX cart API doesn’t help because it produces a new cart token that’s not associated with the current order.

Any pointers would be highly appreciated, this is affecting most of our merchants, since Customer Extensions aren’t widely adopted and aren’t GA yet.

Update

It seems to only be affecting some merchants, it’s not all. Still haven’t found a good workaround, there doesn’t seem to be any other way to retrieve the order ID from JS programmatically.

Use checkout token to find the order. The order id is not guaranteed on those pages from quite some time.

Thanks @Patrick_Jakubik

Do you know how to find the checkout token from the window.Shopify object in the order status page?

I’m not seeing any identifiers at all under the window.Shopify.Checkout object.

Sure, it’s under window.Shopify.checkout.token

Nope, the new format for this case is window.Shopify.Checkout not window.Shopify.checkout.

CleanShot 2024-11-19 at 09.36.59

Yes, the old format for getting the order ID was window.Shopify.checkout.order_id but this new uppercase window.Shopify.Checkout doesn’t have the same properties:

Object.keys(window.Shopify.Checkout)
-> ['apiHost', 'assetsPath', 'i18n', 'isOrderStatusPage', 'token', 'hasSellingPlan', 'OrderStatus']

So if the merchant’s order status page has this new window.Shopify.Checkout object, it’s a new version that doesn’t seem to have any of the checkout/order details whatsoever.

Weird! In the store I tested, it is available both under window.Shopify.checkout and window.Shopify.Checkout. In the later, the checkout token seems to be under window.Shopify.Checkout.token

CleanShot 2024-11-19 at 09.55.57

Yea, it’s not all stores (thank goodness).

The only other way I can think to make this association without a token is scraping the order name from the HTML, which involves another GraphQL call to retrieve the order ID. Not ideal.