Access Checkout Attributes from the order status page script

udaraw
New Member
2 0 0

Similar to https://community.shopify.com/c/Shopify-APIs-SDKs/Access-attributes-on-order-status-page/m-p/1150297...

I have set checkout custom attributes as indicated here using the Javascript Buy SDK. In this flow, the user lands on our site, adds items to the cart and is ultimately redirected to the Shopify checkout flow in order complete payment. 

We have an integration with a referral partner so we need to track traffic attribution via a clickid. This is the custom attribute that we attach to the checkout using updateAttribute. .

I can see the attached attribute on the order admin page as shown below.

udaraw_0-1619551048711.png

 

On the order status page I'd like to add a script to use this custom attribute and make a call to our referral partner to confirm that the referral led to a completed order.

According to the documentation here, I should have access to the full checkout object in the order status page's additional script textbox. However, when I inspect the checkout object on the order status page, it doesn't have an attribute key. Why is the attributes key not exposed? Is there a workaround for this? 

Replies 2 (2)
CalD
Shopify Staff
Shopify Staff
140 21 32

Hey @udaraw,

What's the shop id of the store, and order id of the order, that you're using to test? 

Additionally, can you post the code you're currently using to attempt to retrieve the checkout object?

CalD | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

buildpath
Shopify Partner
51 10 15

Hi, I was also struggling with this and I found that a few different syntaxes seem to work to display an attribute on the order status page.

 

  • {{ attributes["attribute_name"] }}
  • {{ attributes['attribute_name'] }}
  • {{ attributes.attribute_name }}
Ecom entrepreneur since 2004 | Shopify App developer since 2021 | Shopify merchant and theme developer since 2016