What's your biggest current challenge? Have your say in Community Polls along the right column.

Re: Preserve line breaks in text area

How can I keep line breaks in customer text inputs on product page?

PWS1
Explorer
111 3 8

All line breaks are removed from the text area inputs on my product page when the customer clicks "add to cart".  How do I preserve the line breaks that they enter in the text area so they show in the cart?

 

Image 1 shows how the text looks when a customer enters it on the product page.  Image 2 shows what happens after you click "add to cart".  As you can see, all line breaks are removed so the text is one big run on sentence.

 

Product page: https://www.palmettowoodshop.com/products/personalized-baby-block

 

Image 1Image 1Image 2Image 2

 

Replies 2 (2)

oscprofessional
Shopify Partner
16116 2410 3126

Hi, 

You need to add the code from where the cart page content is appearing.

{{ product.metafields.my_fields.accordian_content_2.value | newline_to_br}}

 

Check the code in cart page liquid file.

 

Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: pallavi@oscprofessionals.com | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing | Oscp Upsell & Cross sell App : Free | Oscp Sales & Volume Discount App : Free | Custom Pricing Wholesale App : Free
PWS1
Explorer
111 3 8

Any other suggestions?  That code didn't work.