Reputation: 8458
I am setting up a cookie inside a script file; however, I do not seem to find any working way to grab the value of that cookie and compare it against another value using Shopify liquid if statements?
For example,
I have a cookie set as: customer_email: '[email protected]'.
I would like to grab this cookie value somehow and compare it using Shopify's if statement as below:
{% if customer_email == '[email protected]' %}
DO SOMETHING
{% endif %}
Upvotes: 2
Views: 5966
Reputation: 159
It's not possible to read cookies from Liquid. But you can read the value client-side with JavaScript in the Liquid template.
Upvotes: 2