Shopify: Variables Available on Thank You Page?

4k Views Asked by At

I've got a small bit of code on my Shopify thank you page for a home grown fulfillment system. In oversimplified terms, it outputs a URL with template code that uses the {{id}} field.

<p>
    Your order information is {{id}}!  This is not the actual code, 
    this is just an oversimplified version for this question
</p>

Up until a few weeks ago, the {{id}} template variable would output the ID of the order object. I use this ID and the Shopify REST api to fetch order information. Now, for reasons that remain unclear to me, this outputs a different number that appears to be the checkout-id field.

Is this intended behavior? Is there anyway to get the old, real order object ID back? I can think of numerous ways to work around this, but I'd rather not mess with a system that's worked in a stable way for the past 5 years.

1

There are 1 best solutions below

1
On BEST ANSWER

Documentation on this is spotty at best, but it seems like the old global liquid variables I've been using have changed their behavior. Acording to Shopify's documentation, on that Thank You page

You have access to the checkout and shop liquid objects

There's documentation on both the checkout and shop objects, and I was able to get the old behavior I was after by replacing {{id}} with {{checkout.order_id}}.

It also appears there's a liquid order object available as well, but given it's not documented as being available on the checkout page, I'm not sure I'd trust it to keep working.