Hello,
I have a script running that depends on the “window.Shopify.checkout” object in Thank-You page.
But the object is rather unreliable, and is undefined for certain orders.
I noticed the object present for roughly 50% of the orders of a Particular store and the object was undefied for the other 50%
Any leads in addressing the issue will be of great help.
Hi @Sherki
The Shopify.checkout variable is not defined on all Shopify storefronts. It is defined on storefronts that are using the latest version of the Shopify checkout API. If you are seeing the error it means that the Shopify.checkout variable is undefined on your storefront. This can happen for a few reasons:
You are not using the latest version of the Shopify checkout API
You are not on a Shopify Plus account
You are not on a storefront that has enabled the Shopify checkout API
If you are not on a storefront that has enabled the Shopify checkout API, you will need to contact Shopify support to enable it for your storefront.
@Huptech-Web
Thanks for the reply.
I am sure the Store is on Shopify Plus Plan.
As i mentioned, I’m able to access the checkout variable from dev console on thank-you page.
{window.Shopify.checkout} for few orders. While same is undefined for other orders of the same store.
@Sherki you may need to add a delay or event listener for DOMContentLoaded so that the page has enough time to fully load the data including this window variable so the value is not undefined.