Hello,
I am trying to to output the following single line text list metafield in the frontend.
This is what it is supposed to look like:
The idea is that our client can select the values in the backend and based on that the frontend outputs the icon and title within this container.
This is what it currently looks like:
I´ve tried a when statement and an if statement with contains immune for example. Unfortunately it does only output the array from the list metafield. Please have a look at my code. Maybe you have an idea what is wrong - help is very much appreciated:
benefits
{% assign selected_benefits = article.metafields.custom.ing_benefits.value | downcase | split: ", "%}
{{selected_benefits}}
{% if selected_benefits contains "immune" %}
this is a test
{% endif %}
{% case selected_benefits %}
{% when '[immune"]' %}
mental health claim
{% when '["vegan"]' %}
vegan claim
{% else %}
Select Value in ing_benefits metafield
{% endcase %}
Thanks to everyone.
All the best,
Flexowitsch