Post Purchase Scripts Not Executing As Expected

3 0 1

I need to get the customer id on the "thank_you" page. I'm expecting either a liquid script {{ }} or javascript window.Shopify.checkout.customer_id to store this information. 


There are 2 issues:

1. The post purchase scripts (settings -> checkout -> "Post-purchase page") aren't running

2. The customer id is null on the "thank_you" page


Steps to reproduce:

Order status page script:

console.log("order status");

Post Purchase Page script:



Screen Shot 2022-12-21 at 6.21.54 AM.png


This is the "thank_you" page. I'm expecting the post purchase script to run and there to be some reference to the customer id in either liquid or global shopify object. Inspecting window.Shopify results in only null's for customer data. 


Upon reload of the page, the "order status" page, the customer id appears from liquid:

Screen Shot 2022-12-21 at 6.22.03 AM.png


Any insights would helpful. Thanks

Reply 1 (1)

Shopify Partner
166 9 46

I have just tried this on my own store and it seems to work.

For the post-purchase thank you page, we can only access the {{ checkout }} liquid object directly  (the {{ order }} is not available), you can reference the checkout liquid object here :

To get the order id, you can use {{ checkout.order_id }}, to get other order attribute such as customer id, you can use {{ }}  etc.

Hope this can help

Spent too much support time dealing with order cancellation request from customer? Wouldn't it be good if customer can cancel order on their own without bugging your support? Try out Cancellable app! . I also write articles about store customization that can improve your customer shopping experience here : Yagi Software Blog