🧠 Basic Liquid: turn list into string with liquid tag

🧠 Basic Liquid: turn list into string with liquid tag

dsktdskt
Shopify Partner
6 0 2

Hi guys, 

Here's something that's probably very basic but I can't figure-out.

 

Artboard – 2.png

 

I have a metafield which definition is single line of text + list of values + preset choices. Basically, a multi-select field.

When I print this field on a page with liquid, it is auto-formatted into a <li> list.

What can I add to the liquid tag to turn it into a comma-separated string?

 

Thank you!

 

Reply 1 (1)

Lee-Strong-SEO
Shopify Partner
127 19 26

Hi @dsktdskt

 

I have created a metafield in my store with the exact same setup as you mentioned and I was able to create a list of items in the metafield using this liquid code:

 

Pairs well with <BR>{{ product.metafields.custom.goes_well_with | metafield_text }}

 

My metafield is named "product.metafields.custom.goes_well_with" which you can adjust to your metafield name. The output of this is shown in the image below.

 

LeeStrongSEO_0-1700529427464.png

 

Strong SEO

This simple trick can boost your store to the top of Google - Try it Now