Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shopify: Variables Available on Thank You Page?

Tags:

rest

shopify

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.

like image 636
Alan Storm Avatar asked Jun 23 '15 02:06

Alan Storm


People also ask

How do I customize my thank you page on Shopify?

You can change your Shopify thank you page through the use of Shopify apps or editing the JavaScript or CSS code. To add code, go to Settings > Checkout > Order processing > Additional scripts. You can also edit your theme by going to Online Store > Themes > Actions > Add code.

Does Shopify have a thank you page?

Simply put, a Shopify thank you page is the page you are taken to after completing a final action on a store. Naturally, the page will give you a brief thank you message that denotes the owner's appreciation for completing that action - just like any customer would expect.

How do I add a variable in Shopify?

Adding variables to actions You can add variables to any text field that contains the Add variable link. Click the Add variable link beneath the relevant field, and then choose a variable from the list.

How do I customize my Shopify Order page?

To access additional scripts, start from your Shopify admin, and go to Settings > Checkout. Under Order status page you find the Additional scripts section. To access additional scripts, start from your Shopify app and go to Store > Checkout. Under Store settings, tap Checkout.


1 Answers

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.

like image 168
Alan Storm Avatar answered Sep 21 '22 08:09

Alan Storm