How to close quotes with liquid code inside the quote?

Tourist
7 0 1

Hi everyone,

 

How do I get value to recognize the complete product title when the title has a quotation mark inside?

 

<input type="hidden" name="contact[Product]" value="{{ product.title }}">

 

For example, with product title below

ABC Product 27" Glass Door

 

In html it turns into this

<input type="hidden" name="contact[Product]" value="ABC Product 27" Glass Door">

 

The issue is value="ABC Product 27"  when it should be value="ABC Product 27" Glass Door"

 

If I use ' instead of ", the same issue arises when I have product titles with ' in them. 

 

Any help is appreciated. Thanks.

 

 

 

0 Likes
Shopify Partner
1841 170 483

You can use

{{ product.title | escape }}

But the actual issue is that you are using double quotes " instead of double prime  to represent inches - more info here. You would not need to escape the double prime.

 

Best wishes!

I turn coffee in to code - since 1998
1 Like
Tourist
7 0 1

Thanks for the help Karl. How do you use double prime in a product title?

0 Likes
Highlighted
Shopify Partner
1841 170 483

It's a regular keyboard character - I don't know what it is on Windows OS, on Mac OS X it is Shift + Option + G. I am sure Windows will have something too - if not, you can use the Character Map to find it, then create a keyboard shortcut.

I turn coffee in to code - since 1998
1 Like