Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I need to display all values from richtext, e.g.:
⚠ Dieser Artikel fällt kleiner aus
Wir empfehlen Dir, diesen Artikel eine Nummer größer zu kaufen
My code is:
{{ product.metafields.product.passform }}
Displays this:
{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"⚠ "},{"type":"text","value":"Dieser Artikel fällt kleiner aus\n","bold":true},{"type":"text","value":"Wir empfehlen Dir, diesen Artikel eine Nummer größer zu kaufen"}]}]}
I found the solution {{ product.metafields.product.passform | metafield_tag }}
But it doesn't transfer text from the new line
How to display values with new lines?
Solved! Go to the solution
This is an accepted solution.
You need to access like this
{{ product.metafields.product.passform | metafield_tag }}
- Your Coffee Tip can create magic in coding ☕✨
- Seeking a Shopify Certified Developer? Contact us Shopify Verified partners
This is an accepted solution.
You need to access like this
{{ product.metafields.product.passform | metafield_tag }}
- Your Coffee Tip can create magic in coding ☕✨
- Seeking a Shopify Certified Developer? Contact us Shopify Verified partners
To display the values with new lines from the RichText data, you can use the HTML <br> tag to create line breaks. Since the data you have is in a structured format, you'll need to convert it to HTML with line breaks before displaying it.
Here's how you can achieve
{{ product.metafields.product.passform | metafield_tag | replace: '\n', '<br>' | raw }}
the part of code after metafield_tag doesn't work
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025