View the original community article here
Last tested: May 2020
This comes in handy when you has a comma-separated list and you want to format it or apply links to each comma-separated value.
For example:
List |
---|
apple, banana |
orange, apple, banana |
Since the "list" fields can have either 2 values or 3, we can easily use the split
function to format the list with bullet points regardless of how many values there are.
dimension: list {
type: string
sql: ${TABLE}.list ;;
html:
{% assign words = {{value}} | split: ',' %}
<ul>
{% for word in words %}
<li> {{ word }} </li>
{% endfor %} ;;
}
This generates a bullet list on our original comma-separated list.
Link to Shopify Documentation on split
This content is subject to limited support.