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!
User | RANK |
---|---|
33 | |
25 | |
16 | |
9 | |
9 |
Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023Summary of EventsBeginning in January of 2023, some merchants reported seeing a large amo...
By Trevor May 15, 2023With 2-Factor Authentication being required to use Shopify Payments, we’re here to help yo...
By Imogen Apr 26, 2023