I see that in certain stores I can access the checkout object through the Shopify.checkout variable but in other stores this variable is not defined.
In the stores where the checkout object is defined, the checkout HTML page contains this snippet:
<script>Shopify.checkout = { ... }</script>
However this snippet is not included in the others.
Where that snippet come from? How can I force it to be included in the stores where is not available?
Basically I need to get the line items of the checkout from a script we inject in our client’s checkout page. I can’t modify the liquid templates so using {% checkout … %} is not a solution.
I’m the developer of an app, not a merchant. My app needs to get the line item objects when the checkout page is shown, but the Shopify.checkout object is not always available in all stores my app is installed in.
I can’t modify my client’s the liquid templates, I need to get the line item objects through JavaScript once the checkout page is loaded.