Preserving New Lines via API
-
I have a Windows application that I enter my inventory into, it then posts the inventory to eBay and my WooCommerce site.
I have added support for attributes and now my only issue is preserving new lines in the attribute value. I can do it in the administrative panel manually… Edit attribute value (br is stripped), Enter key’s new line will save and display on front end.
However, I cannot pass any of these via the API, br is still stripped as well as environment.newline vbCrLf is also removed.
This is what I am trying to enter:
Fitment
GENESIS 09-12 (electric windows), Sdn, L., laminated glass (opt 8243A2)
GENESIS 13-14 (electric windows), Sdn, L.This is what is showing:
Fitment
GENESIS 09-12 (electric windows), Sdn, L., laminated glass (opt 8243A2) GENESIS 13-14 (electric windows), Sdn, L.For items with longer attribute values (some have several lines) it is a clustered, hard to read, impossible to understand mess.. Like this:
Available with chrome or painted lower moulding., B, fits, A, ; difference is glass type. HY 760043M000 door $856 HY 824113M000 glass $429 HY 824013M050 reg, ’11- $125 HY 824013M000 reg, ’09-10 $125 HY 824503M000 motor $376 KI 760043M000 door Ident: 760043M000 W/tempered glass. HY 824113M021 glass $485 KI 760043M000 door shell W/laminated glass. Hyundai option code 8243A2 – Acoustic Laminated Glass, Front Door.
Which should read…
Available with chrome or painted lower moulding., B, fits, A, ; difference is glass type.
HY 760043M000 door $856
HY 824113M000 glass $429
HY 824013M050 reg, ’11- $125
HY 824013M000 reg, ’09-10 $125
HY 824503M000 motor $376
KI 760043M000 door Ident: 760043M000 W/tempered glass.
HY 824113M021 glass $485
KI 760043M000 door shell W/laminated glass. Hyundai option code 8243A2 – Acoustic Laminated Glass, Front Door.I read somewhere that I should not assign new lines to non-variable product attributes, but I figure it should not hurt anything (doesn’t seem to be) as I have no variable products. ??
Thank you!
PS., WooCommerce is great an V3 API is very nice to work with.
- The topic ‘Preserving New Lines via API’ is closed to new replies.