Personalized checkout and custom promotions with Shopify Scripts
I am trying to collect data from the order status page via Liquid script but I am getting inconsistent results when accessing checkout.line_items.
I added the code below to the order status page additional scripts section, and for some orders I get the correct amount of items, but for some I get 0. I can't find a pattern, but it's consistent between orders (once 0 always 0, once correct always correct). For some orders this prop exists, for some it doesn't.
Obviously all orders have items.
Can anyone shed some light please?
To complement, the whole checkout object seems to not be present. This line of code prints nothing:
console.log('checkout.id', {{checkout.id}});
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025