FROM CACHE - en_header

Styling Metafields

Solved
kevinrein
Tourist
9 0 1

Hello! First time posting here so I'm unsure if this is the right space. I'm adding custom elements in product pages using metafields I've added through Custom Fields by Freakdesign (really awesome extension BTW) and while I've allowed the field to be an expanded text field, I can't seem to add styling. Even if I make the metafield value a bulleted list for example, how it's displayed is still in a one line format. Is it possible to style metafields a certain way? And if possible, how can I do this?

Thank you very much to anyone who answers or assists!

Accepted Solution (1)

Accepted Solutions
Jason
Shopify Expert
10959 196 2213

This is an accepted solution.

Glad the extension still works for you as Admin updates are causing some people grief. Will solve that at some point but do expect it to cause you some pain in the short term.

If you're looking to add a list why are you not adding it as HTML? eg:

<ul>
  <li>a</li>
  <li>b</li>
  <li>c</li>
</ul>

If you don't want to do that then you need to think about how the string will be split up in your Liquid code. One approach is to add a string like "a|b|c" and have Liquid split the string into pieces at the pipe character. From there loop over the pieces and build up the list so it looks like the above.

As a side question, why does this need to be a metafield?

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★

View solution in original post

Replies 5 (5)
Jason
Shopify Expert
10959 196 2213

This is an accepted solution.

Glad the extension still works for you as Admin updates are causing some people grief. Will solve that at some point but do expect it to cause you some pain in the short term.

If you're looking to add a list why are you not adding it as HTML? eg:

<ul>
  <li>a</li>
  <li>b</li>
  <li>c</li>
</ul>

If you don't want to do that then you need to think about how the string will be split up in your Liquid code. One approach is to add a string like "a|b|c" and have Liquid split the string into pieces at the pipe character. From there loop over the pieces and build up the list so it looks like the above.

As a side question, why does this need to be a metafield?

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
Léa_Petitjean
New Member
1 0 0

Hello Jason,

I have tried your solution on both apps FreakDesign (ShopifyFD) and Metafields Editor and the html language inside a metafield does not work for me.
Here is below the value I entered for my metafield meta.description_excerpt (namespace : meta / key :description_excerpt on FD) :

 And it is still showing non formatted. (> https://petitjeanparis.com/products/bracelet-foret?variant=7537620516923)  Any idea why ?
Thank you !

<p>Envie d'une touche délicate et colorée dans votre tenue ? Découvrez notre bracelet en soie Forêt et son ballet nocturne de renards dans une forêt bleu roy. 

<br> Inspiré de la forêt jurassienne, région d'origine de notre designer, notre bracelet sera le détail élégant de votre tenues.
<ul>
<li>100% twill de soie: pour son tissage nervuré qui accroche la lumière</li>
<li>Dimensions 45cm X 5cm: la longueur parfaite pour le nouer au poignet</li>
<li>Confection française: parce que la tradition lyonnaise de la soie a plus de  600 ans !</li>
<li>Emballé dans son coffret blanc: idéal pour l'offrir ou le ranger dans les bonnes conditions</li></ul></p>

 

 

kevinrein
Tourist
9 0 1

Hi Jason! Thank you for the response. Strange, of course I was trying to do bulleted lists and paragraphs by using HTML prior to me writing the post and it wouldn't work; nevertheless, I tried again and now it does. Unsure what I was doing wrong the first time. Anyhow, thank you for the help!

For the side question: we have a cosmetics line we are selling and products have a ton of information to show. We want to place the other details such as directions for use and ingredients in accordions to not clutter the page with too much text. Thus, the use of metafields to populate the accordions.

TheNest
Tourist
3 0 6

Is there a way to change the font size/style on metafields? I'd like to use my subtitle (in lieu of my product title) on my product pages in crave. I only seem to be able to change body/title in my theme area. 

Thanks!

Tobias5
Shopify Partner
14 0 15

It would be fantastic if we can choose to us a rich text field as a metafield. Html is fine as well, but for any content editor a rich text field is a must.