简体   繁体   中英

Retrieving Shopify cart attributes on the order status page

Is it possible to get the cart attributes on the Shopify order status ("") page and if so how?

On my Shopify store website I have some JavaScript which POSTs some JSON data to "/cart/update.js", with the data set to { attributes: {"MyLocalVar":1234} } which sets "MyLocalVar" in the cart attributes and is available elsewhere on my website when I GET from "/cart.js". What I would like to do now is to access "MyLocalVar" on the order status ("") page.

Does anyone know how I can do this?

An alternative would be to set "MyLocalVar" in the line item properties since that is available on the order status page, however I can't see how you can set this using the Shopify AJAX API.

On the Shopify order status page there is a global checkout object that has the cart attributes.

To access, use checkout.attributes which is an array of the cart attributes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM