Formating text separate with commas to line breaks in a Metafield

Hi,

I have data that comes from an ERP via a Shopify connector and for a metafield, the values ​​are separated by commas and I would like them to be separated by line breaks. I was thinking of doing this with a Shopify Flow so that each time the value is added or modified, the Shopify Flow reformats the data, but I’m looking for a way to do it. See screenshots.

Thanks :slightly_smiling_face:

Hello @michelp ,

If you have created a metafield for a product, you can enter any comma-separated data into the metafield of that product. After that, you can call it out line by line on the product page. To do this, you need to follow these steps:

  1. Go to the settings → custom data and create a metafield in product.
  2. Search for the specific product where you want to show the details and enter the data into its metafield as comma-separated values.
  3. After that, go to the dashboard, then Online Store, and click on Customize. When the top bar appears in the center, where it says “Homepage,” click on it to open the default product.
  4. Then go to Product Information, add a block, and choose the Custom Liquid block. Paste your code there.
{% assign materials = product.metafields.custom.material | split: ',' %} 
{% for material in materials %}
    

{{ material }}

{% endfor %}

Hello,

It works, but the metafiled values ​​are added at the bottom of the block I added. How can I get the formatted content in a collapsible row as it was displayed before, when I added the block? See screenshot.

Thanks :slightly_smiling_face: