All things Shopify and commerce
Hi,
I have a metaobject in a liquid section on my page that is displaying single-line text as expected BUT I have a field with richtext that is rendering with some code wrapped around my dynamic content.
I tried adding a '{... .value | richtext }' to my metaobject value without luck.
Here is my code in the liquid section:
<div class="content-container">
{% if page.metafields.custom.ja_faq %}
{% assign testvariable = page.metafields.custom.ja_faq.value %}
<div class="intro-content">
<h2>{{ testvariable.heading }}</h2>
<div>
{{ testvariable.paragraph.value | richtext }}
</div>
</div>
{% endif %}
</div>
Here is how it's rendering:
Appreciate the help!
Solved! Go to the solution
This is an accepted solution.
Ok I finally figured this out. The solutions was to replace
{{ testvariable.paragraph.value | richtext }}
with
{{ faq.answer | metafield_tag }}
The " | metafield_tag" filter automatically converts Portable Text JSON into valid HTML and the filter " | richtext" is used for older rich text formats but does not properly handle the new structured content format.
This is an accepted solution.
Ok I finally figured this out. The solutions was to replace
{{ testvariable.paragraph.value | richtext }}
with
{{ faq.answer | metafield_tag }}
The " | metafield_tag" filter automatically converts Portable Text JSON into valid HTML and the filter " | richtext" is used for older rich text formats but does not properly handle the new structured content format.
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