• Resolved adwjoe

    (@adwjoe)


    Hi,

    My product descriptions are missing the new lines when imported into the website.

    When entered into Square I use the enter button to add new lines. When imported into WooCommerce the new lines are missing.

    Is this a database collation issue? An nl2br issue? This is really ruining the formatting of the product page and I could do with fixing it.

    Thank you.

    Joe

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support wpnomad a11n

    (@wpnomad)

    Hi @adwjoe ,

    `My product descriptions are missing the new lines when imported into the website.

    When entered into Square I use the enter button to add new lines. When imported into WooCommerce the new lines are missing.

    Is this a database collation issue? An nl2br issue? This is really ruining the formatting of the product page and I could do with fixing it.`

    Is the entire text of the description being imported, but are missing any line breaks? Or do you mean that after the first line, the content of description from second line onwards are not being imported to WooCommerce entirely?

    Do let us know so we can check and help further.

    Thread Starter adwjoe

    (@adwjoe)

    The entire description is imported into WooCommerce, but it is missing the new lines between paragraphs.

    For example, a product description on Square is:

    3.8%

    Small Pale

    Taking a bijou interval from Brobdingnagian brewage to reveal a petite pale ale of graceful proportion.

    Once imported into WooCommerce the description is now:

    3.8% Small Pale Taking a bijou interval from Brobdingnagian brewage to reveal a petite pale ale of graceful proportion.

    Plugin Support B C. a11n

    (@battouly)

    Hi @adwjoe,

    Thanks for the clarification.

    Currently, Square doesn’t support using HTML formatting in the product description. When you import an item in Square with HTML tags, the tags will be stripped.

    If you want to add formatted product description, you will have to add it in your WooCommerce site directly.

    Thread Starter adwjoe

    (@adwjoe)

    I’m not using HTML formatting in the description.

    I’m adding new lines in a text-area in exactly the same way as I’m adding them into this text-area that I’m typing in right now.

    This should be supported out of the box without needing to manually adjust the descriptions for each product in WooCommerce.

    Where is the data stored for each product on my server? I’ve looked through the entire MySQL database but can’t find it. Is the data stored in a file somewhere? I’m self-hosted with complete access to my server and db.

    Thread Starter adwjoe

    (@adwjoe)

    I found the data in wp_posts.

    Why are the new lines being stripped out? This is really frustrating. Formatting text to add paragraphing is essential in product communication.

    In a working environment I cannot double my workload by having to enter the data twice, once in Square and again in WooCommerce. The data already exists once formatted the right way, so I just want that data formatted the same way.

    Could you point me to exactly where on the server I can find the function which handles import? I’d like to have a play around to fix this.

    Thanks!

    melinda a11n

    (@melindahelt)

    Automattic Happiness Engineer

    The line breaks that you are adding in Square are also considered HTML and that is why they are being stripped out.

    I would recommend adding the details into WC and syncing it to Square and see if that works better for you.

    Thread Starter adwjoe

    (@adwjoe)

    Line breaks entered into text areas are not HTML and they are essential for product descriptions. Even if they are HTML the fact there isn’t a condition to allow <br/> into the description is baffling me. Formatting text is a key part of selling online.

    Setting WooCommerce as the Product System of Record is an unworkable suggestion. I will be having between 500-1000 lines of constantly changing beers with a physical shop that is also selling over the counter. I need the register – Square – to be the System of Record.

    Please, please could someone point out where in the code the import is happening? I’ve had a cursory glance but I’ve got another 1001 things I’m having to get ready for this shop so haven’t dived in deep yet. I wish to manually edit the code to fix this issue. I’m aware there is a risk I may break the entire plugin but I am willing to take that risk. It’s my risk to take.

    Thank you.

    Plugin Support Thu P. a11n

    (@thup90)

    Hi there,

    Line breaks entered into text areas are not HTML and they are essential for product descriptions. Even if they are HTML the fact there isn’t a condition to allow <br/> into the description is baffling me. Formatting text is a key part of selling online.

    I understand having line breaks is important to you when syncing from Square to WooCommerce. We’d appreciate your suggestion if you could add it in our Ideas board, it’s where our developers go to for feature ideas:

    https://ideas.woocommerce.com/forums/133476-woocommerce

    Please, please could someone point out where in the code the import is happening?

    Product sync functions are located under woocommerce-square/includes/Sync/

    Feel free to get back to us in case you have any additional questions!

    • This reply was modified 3 years, 5 months ago by Thu P. a11n.
    Thread Starter adwjoe

    (@adwjoe)

    Hi Thu P. a11n,

    Thank you for pointing me in the right direction.

    I have found the source of the problem and have posted the solution on the ideas board. I have tested it on my site and it works.

    It is simply a case of changing the WooCommerce function used on line 1311 of woocommerce-square/includes/Sync/Product_Import.php to sanitise the data from wc_clean() to wc_sanitize_textarea().

    It’s an incredibly easy fix. I hope the developers can pick up this low hanging fruit!

    Here is the thread on the ideas board:
    https://ideas.woocommerce.com/forums/133476-woocommerce/suggestions/43646910-keep-new-lines-in-product-description

    Regards,
    Joe

    • This reply was modified 3 years, 5 months ago by adwjoe.
    Plugin Support Saravanan S, a11n

    (@simplysaru)

    Hey @adwjoe,

    Thanks for adding the solution to the Ideas board.
    I will work towards getting the attention of the devs to this suggestion of yours.

    Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Description Missing New Lines’ is closed to new replies.