How to get cart token by Shopify Liquid
Cart Token is meant to be a shopping cart ID of the client in a session, that generated by Shopify when an item is added to cart. Sometime you want to get this value to check something but Shopify doesn’t support that. In fact, with a small tip you can get this value with Shopify liquid.
Let’s try with the below code.
1 | {% assign cart_token = cart | json | split:'token":"' | last | split:'"' | first %} |
Looks like this is not valid anymore 🙁