Liquid, JavaScript, themes, sales channels
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 }}
This is an accepted solution.
You need to access like this
{{ product.metafields.product.passform | metafield_tag }}
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
User | RANK |
---|---|
35 | |
25 | |
14 | |
13 | |
9 |
Make the shift from discounts to donations, and witness your business not only thrive fina...
By Holly Dec 4, 2023On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023