What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Dynamic sources convert HTML to text in richtext field

Dynamic sources convert HTML to text in richtext field

RiccardoPavesi
Shopify Partner
5 0 5

Hi,

I'm facing an odd bug.

I've a multi-line text metafield linked to my product page as a dynamic source in a richtext field (the only one that supports it).

Schermata 2021-09-27 alle 15.56.34.png

 

 

 

 

 

 

If I include some simple HTML tag in the metafield value in the product, they are converted as text and shown in the page.

Schermata 2021-09-27 alle 15.57.18.png

 

 

If I add to the richtext some other text and use the interface to make it italic it's displayed correctly. I think that is a bug because there is no way to include some formatting in a metafield multi-line text using the customizer.

I've tried to use a single-line text metafield as a dynamic source of a text field and putted some HTML tags in it and it works like a charm, in a field that is supposed to strip that.

Replies 4 (4)

mleimbach
Shopify Partner
7 0 5

whould also be interested in a solution.

Matthias Leimbach
Lead Development

beeclever
Koblenz, Germany
hola1
Shopify Partner
2 0 0

Any news on this? I'm facing the same problem.

RiccardoPavesi
Shopify Partner
5 0 5

Unfortunately no.

 

I've found a workaround: In the block I print the metafield directly via liquid referencing it with product.metafields.my_meta.meta_name where my_meta and meta_name are the ones I've chosen. In that way the HTML works fine.

 

If you're a bit more advanced with liquid you could pass the "meta_name" value in the block settings as string and access it in the object with product.metafields.my_meta[block.settings.meta_name] to keep it dynamic and controllable in the customizer.

hola1
Shopify Partner
2 0 0

Thank you! that would work for me.