Liquid, JavaScript, themes, sales channels
Note for Shopify users, never used Jekyll or liquid directly so not sure if this issue exists outside Shopify
Say you created an array
{% assign input = "A,B,C" | split:"," %}
And say that you want to check if something from Shopify API is in that array, this won't work
{% if input contains {{ gift_card.product.title }} %} {% else %} do stuff! {% endif %}
And strip filters won't work either, you have to remove the space between the word and the brackets after `contains` so it looks like this
{% if input contains {{gift_card.product.title}} %} {% else %} do stuff! {% endif %}
`{{gift_card.product.title}}`, I spent a good 3 hours to find this bug, I don't know why it happens, there's no actual HTML spaces or anything like that.
You probably figured this out already, since this is old, but you can't use the curly braces inside other curly braces.
So it needs to be :
{% if input contains gift_card.product.title %}
Helped me more than you will know! Thanks!
Happy to know!
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024