The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Is it possible to carry over formatting when text is added to cart

flinx777flinx777 Member
in Help edited January 2016
We've got a foxycart setup where customers can enter custom text for the product. We've included a text box where they can enter the text but when the add the product to cart, the formatting (i.e. line breaks) is removed. Is there anyway to modify that so that text formatting is carried over to cart/checkout/receipt?

We're using Foxycart 2.0
Tagged:
Comments
  • fc_jedfc_jed FoxyCart Team
    @flinx777

    I tried a couple of solutions, but none of them were successful. I'll consult with the team and get back to you with more information.
  • fc_adamfc_adam FoxyCart Team
    @flinx777,

    We do track those newlines through with the value - for example I just did a quick test with a text area in an add to cart and the value in the JSON looks like this: Line 1\r\nLine 2\r\n\r\nLine 4. We don't convert it to HTML line breaks though, so it's not something that's visible on the page. We do support Twig's nl2br filter, which you could use in a custom "Cart Include" template to convert the custom option value output to be converted. That way the message formatting would be represented in the checkout flow.

    So within the Cart Include template, you'd be looking for this line:
    {{ option.value }}
    And you'd need to update it like this:
    {{ option.value|nl2br }}
  • @fc_adam thanks for clarifying. We'll give that a try.
Sign In or Register to comment.