Multi-Line Text Metafield not rendering HTML.

Solved

Multi-Line Text Metafield not rendering HTML.

Cwilliams44
Shopify Partner
7 0 2

Hello, 

 

I am trying to setup a metafield showing in the box contents for products.  

I am trying to do it as HTML text, however, it does not render out the HTML part. 

 

Has anyone experienced this / know of a fix for this? 

I think Shopify should create a HTML meta-field. 

 

We are trying to update our theme, as the current theme we have does not support Shopify 2.0. 

Our old theme allowed us to create new product description tags like this by simply adding "heading 5" text which would identify the tabe title, then anything below that would be under the new tab. 

 

I wish our current theme did that but sadly it does not so I am stuck doing it with metafields...

 

Screen Shot 2022-04-20 at 3.21.32 PM.png

Cloud City Drones ~ Operations Manager
Accepted Solution (1)

MetafieldsGuru
Shopify Partner
160 32 103

This is an accepted solution.

Hi @Cwilliams44 ,

 

It's a known issue of the multi-line text metafield definitions. The good news is that you can fix it easily with some proper Liquid code. You may want to refer to this thread for more details.

Check out Metafields Guru, the #1 ranked metafields app.

Bulk editor | Data import/export | Metafield sets | Browser extension

View solution in original post

Replies 5 (5)

MetafieldsGuru
Shopify Partner
160 32 103

This is an accepted solution.

Hi @Cwilliams44 ,

 

It's a known issue of the multi-line text metafield definitions. The good news is that you can fix it easily with some proper Liquid code. You may want to refer to this thread for more details.

Check out Metafields Guru, the #1 ranked metafields app.

Bulk editor | Data import/export | Metafield sets | Browser extension
kristinejrb
Explorer
45 0 9

Hi @MetafieldsGuru ! I am having the same issue. I couldn't add the metafields with multi-line. It only allows a single line text.
Please help 

LitCommerce
Astronaut
2860 684 760

Hi @Cwilliams44,

You can change it by adding the code directly at the product page. Can you send me the code of main-product.liquid file. I will check it

LitCommerce - The Most Simple & Affordable Multi-channel Selling Tool.
Effortlessly sell on biggest marketplaces like Amazon, Etsy, eBay, Facebook etc with bulk listing tool, real-time sync & smart order management. Use LitCommerce free for 1-year now!

Struthious
Shopify Staff (Retired)
1 0 0

Hi @Cwilliams44 

The cause of this issue is not in the metafield, rather with the type of field being used to render it as a dynamic source. 

There are 2 types of text fields which are compatible with dynamic sources such as metafields, text fields and richtext fields.

text fields are compatible with Single Line Text metafields, while richtext fields are compatible with both Single Line Text and Multi Line Text metafields. And you can identify if your field is richtext if it has text format icons on the field: 

Struthious_0-1661898746936.png

The issue you are encountering is due to adding a Multi Line Text field to a richtext field, and richtext fields interpret all text as formatted text. This means it purposefully bypasses the HTML interpreter assuming you want the text to display exactly as you entered it.

If however you use a Single Line Text metafield, and add it to a text field, this assumes your text is plaintext and is exposed to the HTML interpreter meaning your HTML will be parsed and converted successfully.

31-38-jf41k-gkuua.png

To learn more visit the Shopify Help Center or the Community Blog.

MRamzan
Shopify Partner
463 3 45

Here is the way to render HTML code.

 

Hire Me:

WhatsApp: +91-9145985880
Email: mohdramzaan112@gmail.com
Skype: mohdramzaan112