Preserving HTML Formatting in Product Feed Fields
WooCommerce product descriptions often contain HTML formatting such as paragraphs, bold text, lists, line breaks, links, and other markup.
For example, a product description may contain:
<p><strong>Premium running shoe</strong> designed for daily training.</p>
<ul>
<li>Breathable upper</li>
<li>Lightweight sole</li>
<li>Available in multiple colours</li>
</ul>Some marketplaces, distributors, catalog systems, or custom integrations accept HTML inside product feed fields and expect the original formatting to be preserved.
Deviking Product Feeds Pro provides the Preserve HTML transformation for this purpose.
When to Use Preserve HTML
Use Preserve HTML when the destination explicitly supports HTML inside a feed field.
Typical examples include:
Description
Short Description
Custom content fields
Long product descriptions
Technical specifications
Formatted promotional textInstead of converting the content to plain text, the original stored HTML is retained.
Configure Preserve HTML
Open:
Deviking Feeds → Feeds
Edit the required feed and go to Mapping.
Find the field that should contain formatted HTML.
For example:
Output Field:
description
Source:
DescriptionThen select:
Transform:
Preserve HTMLSave the feed and use Preview to verify the generated value.
Example
WooCommerce Description:
<p><strong>Premium running shoe</strong> designed for everyday use.</p>
<p>Features a breathable upper and lightweight sole.</p>Mapping:
Output Field:
description
Source:
Description
Transform:
Preserve HTMLThe feed keeps the formatting:
<p><strong>Premium running shoe</strong> designed for everyday use.</p>
<p>Features a breathable upper and lightweight sole.</p>The HTML is not stripped from the value.
Preserving Paragraphs
WooCommerce content:
<p>First paragraph of the product description.</p>
<p>Second paragraph with additional information.</p>With:
Transform:
Preserve HTMLthe output retains both paragraph elements.
This is useful when the destination uses the HTML to display properly separated text blocks.
Preserving Bold and Italic Formatting
Source:
<p>This product is <strong>waterproof</strong> and <em>lightweight</em>.</p>Feed output:
<p>This product is <strong>waterproof</strong> and <em>lightweight</em>.</p>Formatting such as:
<strong>
<em>remains part of the feed value.
Preserving Lists
Product descriptions may contain feature lists:
<ul>
<li>Water resistant</li>
<li>Lightweight construction</li>
<li>Two-year warranty</li>
</ul>With Preserve HTML, the list markup is retained instead of being converted into plain text.
This allows the receiving platform to render the list when HTML is supported.
Preserving Line Breaks
WooCommerce content:
First line<br>
Second line<br>
Third lineWith:
Transform:
Preserve HTMLthe <br> elements remain in the exported value.
Preserving Links
If the product content contains a link:
<p>
View the
<a href="https://example.com/size-guide">Size Guide</a>
before ordering.
</p>Preserve HTML keeps the link markup inside the generated field.
Use this only if the destination permits HTML links in that particular feed field.
Preserving the Short Description
The same feature works with the WooCommerce Short Description.
Configure:
Output Field:
short_description
Source:
Short Description
Transform:
Preserve HTMLWooCommerce:
<p><strong>Compact Bluetooth speaker</strong><br>
12-hour battery life.</p>Feed output retains the original HTML structure.
Description with Fallback
You can also combine Preserve HTML with a Fallback Source.
For example:
Output Field:
description
Source:
Short Description
Fallback Source:
Description
Transform:
Preserve HTMLThe plugin first checks the Short Description.
If it contains a value, that HTML is used.
If it is empty, the Description is used instead.
The final resolved value is then exported with its HTML preserved.
Example with Fallback
Product A:
Short Description:
<p><strong>Compact coffee grinder.</strong></p>Feed result:
<p><strong>Compact coffee grinder.</strong></p>Product B:
Short Description:
(empty)Description:
<p><strong>Professional coffee grinder</strong> with stainless steel blades.</p>Feed result:
<p><strong>Professional coffee grinder</strong> with stainless steel blades.</p>Preserve HTML in XML Feeds
HTML markup inside XML requires special handling because HTML tags must not be interpreted as part of the feed’s XML structure.
When Preserve HTML is used in an XML mapping, Deviking Product Feeds Pro outputs the preserved markup appropriately so that it remains literal content.
For example, the source description:
<p><strong>Premium Jacket</strong></p>
<p>Waterproof and breathable.</p>can be represented in XML as preserved content rather than becoming XML child elements.
A typical result may look like:
<description><![CDATA[<p><strong>Premium Jacket</strong></p><p>Waterproof and breathable.</p>]]></description>This keeps the HTML intact inside the XML field.
Why CDATA Is Useful for Preserved HTML
HTML contains characters such as:
<
>
&which have special meaning inside XML.
Wrapping preserved HTML as CDATA allows the markup to remain literal content.
For example:
<description><![CDATA[
<p><strong>Premium Jacket</strong></p>
]]></description>The receiving platform can then extract the description value and process the HTML if it supports formatted content.
Preserve HTML in CSV Feeds
CSV does not use XML elements or CDATA.
The HTML is written as part of the CSV field value.
For example:
sku,description
JACKET-100,"<p><strong>Premium Jacket</strong></p><p>Waterproof and breathable.</p>"The receiving application receives the HTML markup as text inside the description field.
Preserve HTML vs Strip HTML
These two transformations serve opposite purposes.
Preserve HTML
Use when the destination supports formatted HTML.
Configuration:
Source:
Description
Transform:
Preserve HTMLSource:
<p><strong>Premium Jacket</strong></p>Output keeps:
<p><strong>Premium Jacket</strong></p>Strip HTML
Use when the destination requires plain text.
Configuration:
Source:
Description
Transform:
Strip HTMLThe same source becomes:
Premium JacketWhich One Should You Use?
Use:
Preserve HTMLwhen the destination explicitly accepts HTML.
Use:
Strip HTMLwhen the destination requires plain text.
The receiving platform’s feed specification should determine which option is appropriate.
Different Formatting for Different Feeds
Each feed has its own Mapping settings.
This means the same WooCommerce description can be exported differently depending on the destination.
For example:
Marketplace A
Source:
Description
Transform:
Strip HTMLOutput:
Premium Jacket. Waterproof and breathable.Distributor B
Source:
Description
Transform:
Preserve HTMLOutput:
<p><strong>Premium Jacket</strong></p>
<p>Waterproof and breathable.</p>The WooCommerce product itself is not modified.
Original WooCommerce Content Remains Unchanged
Preserve HTML only affects the generated feed value.
It does not modify:
WooCommerce Description
Short Description
WordPress post content
Product database values
Storefront formatting
Other feedsThis allows the same product content to be reused across multiple destinations with different formatting requirements.
Preserve HTML with Prefix and Suffix
Prefix and Suffix can still be used after the source value is resolved.
For example:
Source:
Description
Transform:
Preserve HTML
Prefix:
<div class="feed-description">
Suffix:
</div>The final feed value can become:
<div class="feed-description"><p><strong>Premium Jacket</strong></p></div>Use custom HTML wrappers only when the receiving platform accepts them.
Important: Destination Compatibility
Not every marketplace accepts HTML.
Some platforms may:
accept full HTML
accept only limited HTML tags
remove unsupported tags
reject fields containing HTML
require plain textBefore using Preserve HTML, check the destination’s documentation.
For example, a platform may allow:
<p>
<br>
<strong>
<ul>
<li>but reject:
<script>
<style>
iframeDeviking Product Feeds preserves the resolved HTML value; the destination decides which markup it accepts.
Example: Product Description for an HTML-Compatible Destination
WooCommerce Description:
<h3>Product Features</h3>
<ul>
<li><strong>Material:</strong> Genuine leather</li>
<li><strong>Colour:</strong> Black</li>
<li><strong>Warranty:</strong> 2 years</li>
</ul>
<p>Designed for everyday professional use.</p>Mapping:
Output Field:
description
Source:
Description
Transform:
Preserve HTMLThe feed keeps the formatted content so the destination can render the heading, list, and emphasis.
Example: Description with Short Description Fallback
A flexible configuration is:
Output Field:
description
Source:
Short Description
Fallback Source:
Description
Transform:
Preserve HTMLThis means:
Use Short Description if available
↓
Otherwise use Description
↓
Preserve the HTML formatting
↓
Export the final valueThis can be useful when different WooCommerce products use different content fields.
Mapping Processing Order
When Preserve HTML is used, the normal Mapping processing order still applies:
Source
↓
Fallback Source if Source is empty
↓
Preserve HTML
↓
Prefix / Suffix
↓
XML or CSV outputThis makes Preserve HTML compatible with the rest of the Mapping system.
Preview the HTML Output
After configuring the field:
- Save the feed.
- Run Preview.
- Inspect products with formatted descriptions.
- Confirm that the expected HTML is preserved.
- Check products using the Fallback Source if one is configured.
- Run Validate Feed.
- Use Save & Generate when the output is correct.
- Check the final generated XML or CSV file.
Recommended Configuration
For an HTML-enabled product description:
Output Field:
description
Source:
Description
Transform:
Preserve HTMLFor Short Description with Description as fallback:
Output Field:
description
Source:
Short Description
Fallback Source:
Description
Transform:
Preserve HTMLFor plain text instead:
Output Field:
description
Source:
Description
Transform:
Strip HTMLPreserve HTML allows WooCommerce’s original formatted product content to be included in XML or CSV feeds without changing the content stored or displayed in the online store.