Order ID in Order Status Page

17 0 6

Right, we can access the Shopify.checkout.order_id value since it is injected into the script.

However, it is not the case if the order is a manually created in admin panel or a transfer order. It doesn't have an associated checkout object in these cases.

Isn't it really strange to not include any pointer / id which is directly related with the order entity instead of depending on the checkout entity which might not be existing? 

More info about my case / custom app: I am using script tags to inject a dynamic section via JavaScript into the Order Status Page which is supposed to retrieve more info about the displayed order via Ajax. Naturally I need order id to get the associated data from the app server. It is working fine for the orders created in the store since they have checkout data, however there is no checkout data for the manually created or transferred (created via API) orders.

Perhaps creating a checkout record for each transferred order will solve half of the problem (which would be really stupid attempt for only getting the order ID in the order status page, but anyway), however manual orders will still not have a checkout record.

I should be really missing something here. There must be a way to access the order id in the dedicated Order Status Page. However, looking at Shopify Digital Downloads app, it can't do the same thing most likely because of the same reason and it doesn't make sense that they see this problem and don't expose the order id in the Order Status Page.

Could you please help me to figure it out if I am missing something?

Thank you.

17 0 6

Ok, I realized that there is an order token at the end of the Order Status Page url. The url is also exposed as the property of __st JavaScript object in the same page.

So, are we really supposed to do the following?

  1. Save the order token in the app database which is returned during the order creation.
  2. Extract the token from the order status page by either using the page url or the __st.pageurl.
  3. Find the corresponding order record in our database by comparing #1 and #2.


No, I should be really missing something here. Order ID should be being provided somewhere in the Order Status page. Please, I am really hoping that someone will tell me that I am missing something.

Wouldn't it be amazing if Shopify could add one more property called as __st.order_id?