`Shopify` global object on thank_you page

greg12
Excursionist
27 0 5

Hi, 

 

I have a question about `Shopify` global object on order status page. I need to use `Shopify.checkout` object to grab data about current order but i noticed two things : 

 

1) `Shopify.checkout`  is sometimes not presented at all 

2) There is no documentation about this. 

 

Maybe documentation is presented somewhere? Should i use liquid snippet instead to make sure everything order ? 

0 Likes

Hello 

You are usinf shopify or shopify plus?

In shopify we have no control of checkout page.

If helpful then please Like and Accept Solution. Free Website Review and advice for sale from Hire us
Shopify Conversion Experts | Shopify Private App | Custom Theme Development | Custom Modifications In To Shopify Theme | Shopify SEO | Digital Marketing | Site Speed Optimization | Performance Site Audit
For Quick Chat Whats app | Email: pallavi@oscprofessionals.com | Skype : oscprofessionals-87
0 Likes
greg12
Excursionist
27 0 5

What do you mean no control? Im not talking about checkout process but order status page which after checkout and we have control. You can run any javascript snippet you want. Im not asking how to run this snippet, but what is available in global scope and if i can trust it. 

0 Likes

Okay.
Refer below link for more help:
https://help.shopify.com/en/themes/liquid/objects/checkout

If helpful then please Like and Accept Solution. Free Website Review and advice for sale from Hire us
Shopify Conversion Experts | Shopify Private App | Custom Theme Development | Custom Modifications In To Shopify Theme | Shopify SEO | Digital Marketing | Site Speed Optimization | Performance Site Audit
For Quick Chat Whats app | Email: pallavi@oscprofessionals.com | Skype : oscprofessionals-87
0 Likes
greg12
Excursionist
27 0 5

Another one offtopic, Please leave this thread. 

0 Likes
liznix
New Member
1 0 0

Sounds like you might be running into this, from the documentation: 

"the Shopify.Checkout.step and Shopify.Checkout.page [javascript] objects are only defined here the first time you land on the page; at this point, it’s a “Thank You” page. If the customer revisits or reloads the page, this “checkout” is converted to an “order”, and the page loads as an “Order Status” page. . . 

Upon reload, both the Shopify.Checkout.step and Shopify.Checkout.page objects will return as undefined, while the Shopify.Checkout.OrderStatus will still show as an object"

0 Likes
PeaceOut
New Member
2 0 2

Hey guys, I'm reopening the conversation as I found some discrepancies in what the Shopify.checkout shows on the thank you page (the first time it loads).

I'm using Javascript to send a JSON message to an affiliation platform on the thank you page. I use the Shopify.checkout object to read a few pieces of information about the order, like the amount, the detail (the lines), but my problem is with the order ID or the order number.

I explain:  for now, I'm scrapping the HTML (via the class .os-order-number) which contains the order number of the order. As the Javascript Shopify.checkout does not contain the order number ... but only the order_id which is different.

Sometimes though, I'm having nothing in the os-order-number and also nothing in the Shopify.checkout.order_id ... but the amount is here and the detail is here also.

Why is the Thank you page is not showing any order number in some cases or does not even contain an order_id in the Shopify.checkout ? 

In our experience, it's 2 to 3% of the orders. 

Thanks for the help if you know anything about that.

RemiLPE
Tourist
5 0 1

Hello PeaceOut,

I have the same problem on orders that contain subscription products, through the ReCharge checkout.

The Shopify.checkout object is undefined.

If you find a solution, I am interested.

Thank you

0 Likes
PeaceOut
New Member
2 0 2

Hey RemiLPE, 

So I have found an answer I think. Basically, when Shopify is too busy with orders, they must have a queue or something, if the queue has not treated the order quick enough, Shopify will show the order page without the order number. Therefore, there's no Shopify.checkout.order_id value neither (null value). That is highly annoying, but unfortunately there seems to have no way to reach Shopify about this matter. 

I know that's it's not a documented thing to use the Shopify.checkout object in the success page, but still, you'd expect consistent values in there. 

So now, I know why it does that (or at least have a very high assumption) but I still don't know how to fix it. 

If someone knows about the problem, is there a way to fix it?