How can I bold specific words in a collapsible row using Dawn Theme?

Hi, I’m trying to bold specific words in my collapsible row content to differentiate between products. I’ve managed to copy code from another discussion and have been successful for that one collapsible row, however, I can’t repeat this code for other rows/words. When I do the code is not accepted. I’m using Dawn Theme. Can anyone advise? Happy to edit the code. Thanks!!!

Hi @KerenN ,

I think you should create metafield for each row. And note type of metafield. They should be single line or multiple line. If you create other type then it will be not accepted.

Hi,

Yes metafields all created. I am now just trying to bold key words in the code.

Can you help? Thanks :blush:

Hi,

You can try to code below:

{%  if block.settings.content contains product.metafields.custom.word %}
                      {%  assign newKeyword = '**' | append:  product.metafields.custom.word | append: '**'  %}
                      {{ block.settings.content | replace: product.metafields.custom.word, newKeyword }}
                    {%  else  %}
                      {{ block.settings.content }}
                    {%  endif  %}

replace “product.metafields.custom.word” width your metafield.

Thanks for this, where doIi input the code?

Hi @KerenN ,

If you use Dawn theme. You can follow the screenshot below:

theme->edit code → sections->main-product.liquid

Thanks - this isn’t working for me. Am I only replacing “product.metafields.custom.word” with metafield?

Hi,

which metafield did you create? Could you give me screenshot?

Hi, thanks for your help but I ended up working it out - changing metafields to rich text instead of multi-line. I had done this initially but finally realised it wasn’t working due to other code I had put in previously to make another sections keywords bold. I removed this code and now rich text is working for me. Appreciate your time anyway :slightly_smiling_face: