896 votes
0 answers
liquid - Splitting Shopify Multi Single Line Metafield to HTML List
Solution:
There is a liquid string filter callednewline_to_br
(reference (https://shopify.dev/docs/api/liquid/filters#newline_to_br)), using the filter you should be able to split the lines like so in liquid:
{% assign lines = "line one\nline two\nline three" | newline_to_br | split: '<br />' %}
<ul>
{% for line in lines %}
<li>{{ line | strip }}</li>
{% endfor %}
</ul>
Demo:
Undefined asked
Source
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.