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.
Nope, the new format for this case is window.Shopify.Checkout not window.Shopify.checkout.
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:
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
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.