How to Make an XML Product Feed?.

XML is the format most shopping channels expect — Google Shopping, Meta (Facebook/Instagram), Pinterest, Bing, and many price-comparison sites all read XML feeds. This guide shows you how to generate a valid XML product feed in CTX Feed, what the output looks like, and how to build a fully custom XML structure when a channel needs one that the built-in templates do not cover.

When to use XML

Pick XML when your channel’s documentation asks for an XML or RSS feed, or when you need nested elements (Google’s g:shipping and g:tax blocks, for example) that a flat CSV cannot represent. If the channel accepts a spreadsheet-style file instead, see How to configure CSV or TXT. You do not need to know XML to produce one — for the ready-made channel templates, CTX Feed writes valid XML for you.

Create an XML feed

  1. In your WordPress dashboard, open CTX Feed → Make feed.
  2. In Feed settings, choose your Country and a Template. For most merchants you would pick the channel by name — for example Google Shopping, Facebook Catalog, or Pinterest.
  3. Set File type to XML. When a template only supports certain file types, the File type dropdown lists just those; the hint under the field shows what the channel supports.
  4. Give the feed a File name and set the Update interval (how often the feed auto-regenerates).
  5. Open the Config tab and review the attribute rows. Channel templates arrive pre-mapped to that channel’s specification, so you can usually leave them as-is or adjust individual rows.
  6. Click Save & generate. CTX Feed builds the XML file and, back on Manage feeds, gives you a Feed URL to submit to the channel.
CTX Feed Make Feed Feed settings card for a Google Shopping feed with the File type set to XML and the five main fields numbered
  1. Country — the market whose tax and currency rules apply.
  2. Template — the shopping channel, for example Google Shopping or Pinterest.
  3. File type — set to XML; the hint lists the file types the channel supports.
  4. Include variations — how variable products are exported.
  5. Update interval — how often the feed auto-regenerates.

Fields that appear only in some setups

The Feed settings card shows extra fields depending on what you pick and which plugins run on the store:

  • Delimiter, Enclosure and UTF-8 BOM — only when File type is CSV, TSV or TXT (see How to configure CSV or TXT).
  • Variable price and Variable quantity — only when Include variations is set to Variable Products (Parent) or Variable + Variations, so you can choose which variation’s price and stock the parent row reports.
  • Sort direction — only after you pick a Sort feed by value other than the default or Random.
  • Items wrapper, Single item wrapper and Extra header — only when Template is Custom Template 1 (not Custom Template 2); see Build a custom XML feed below.
  • Feed Language — only when a multilingual plugin (WPML, Polylang or TranslatePress) is active with more than one language. Choosing a language needs CTX Feed Pro; on the free plugin the field is shown locked.
  • Feed Currency — only when a supported multi-currency plugin is active (WCML, WOOCS, CURCY, YayCurrency, Aelia, WooPayments Multi-Currency and others). Converting prices needs CTX Feed Pro; on the free plugin the field is shown locked.
  • Vendors — only when a multi-vendor plugin (Dokan, WC Vendors, WCFM Marketplace, MultiVendorX or YITH Multi Vendor) is active, to limit the feed to one vendor’s products.

That is the whole process for a standard channel. The sections below matter only when you need to shape the XML yourself.

What the XML output looks like

A CTX Feed XML file opens with an XML declaration, then a wrapper element that holds every product, and one item element per product:

  • The items wrapper surrounds the whole list (Google uses <channel> inside <rss>; a generic feed uses <products>). For channel templates the wrappers are fixed by the channel; you set them only on Custom Template 1.
  • The single item wrapper surrounds one product (<item> for Google, <product> for a generic feed).
  • Each mapped attribute from the Config tab becomes an element inside the item. A mapped attribute with no value for a product is still written as an empty element (for example <g:sale_price></g:sale_price>); CTX Feed never drops a mapped element from an item.

Every non-empty text value is wrapped in CDATA by default, so reserved characters — &, <, > — can never break the file. You can switch this off under CTX Feed → System → Settings → Feed output → Wrap XML values in CDATA; CTX Feed then wraps only the values that actually contain a reserved character.

Build a custom XML feed

When no channel template fits, use one of the two custom templates. Choose them in Feed settings → Template.

Custom Template 1 — name your own elements

Pick Custom Template 1 when you want CTX Feed to build the XML skeleton but you decide the element names:

  1. Set Template to Custom Template 1 and File type to XML.
  2. Three extra fields appear in Feed settings:
    • Items wrapper (required) — the element that surrounds the whole list (default products).
    • Single item wrapper (required) — the element that surrounds one product (default product).
    • Extra header — optional. A namespace such as xmlns:g="http://base.google.com/ns/1.0" is added to the opening tag of the items wrapper (<products xmlns:g="…">); extra elements you type are placed inside the items wrapper, before the products; and an XML declaration typed here replaces the default one (the file always has exactly one).
  3. On the Config tab, add a row per element: type the element name under Channel attribute (spaces become _; namespaced names such as g:id are kept as typed), then map it to a product Attribute or a fixed Text value.

CTX Feed writes each product wrapped in your item element, inside your list element, in the row order shown in the table (drag to reorder).

Custom Template 2 — hand-write the markup

Custom Template 2 needs CTX Feed Pro; without it, a Custom Template 2 feed does not generate. Pick Custom Template 2 (XML) (or a channel that uses it, such as Yandex, Glami or Admarkt) when the channel needs an exact structure you author yourself:

  1. Select the template. The Config tab replaces the attribute table with a line-numbered Feed markup editor and loads the channel’s bundled default markup so you have a starting point.
  2. Write the file body directly. Use loop markers to repeat the item block for every product, and drop attribute shortcodes where each value should appear:
    • The Product attributes → Shortcode helper below the editor lets you pick any attribute and copy its shortcode (for example {title} or {id}), then paste it into the markup.
  3. Click Validate to parse your markup as XML — CTX Feed replaces the shortcodes with placeholder text first, then reports either that the markup is well-formed or the first parser error it finds.
  4. Use Reset to default if you want to discard your edits and reload the channel’s bundled template.

CDATA and special characters

Wrap XML values in CDATA (under CTX Feed → System → Settings → Feed output) is on by default: every non-empty value is written as <![CDATA[...]]>, so a title or description containing &, <, or > stays valid without you escaping anything by hand. A literal ]]> inside a value is handled safely too. Turn the setting off only if a channel objects to CDATA on plain values; CTX Feed then wraps just the values that contain a reserved character and leaves the rest bare. Empty values are never wrapped — they render as empty elements.

Save, generate, and submit

  1. Click Save & generate. Small catalogs finish in seconds; large ones build in the background with a progress bar.
  2. On Manage feeds, open the feed’s ⋮ menu and use Preview to view the live XML in a new tab and sanity-check the structure, or Download to inspect the file locally.
  3. Copy the Feed URL and paste it into your channel’s feed settings. The channel re-fetches that URL on its own schedule, so keep the feed on an Update interval that suits how often your catalog changes.

Troubleshooting

  • The browser shows an XML parsing error when you open the feed. A hand-written Custom Template 2 body (a CTX Feed Pro template) most likely has a mismatched or unclosed tag — run Validate in the editor to find the offending line.
  • A channel rejects the file as invalid. Confirm you chose XML as the file type and that a required namespace is present. For custom templates, add it in Extra header or the markup itself.
  • Values with & break the feed. They are wrapped automatically whether the CDATA setting is on (every value) or off (only values with reserved characters). If a channel still complains, check that nothing else — a caching or optimisation plugin, or a hand-written Custom Template 2 block — is rewriting the file after CTX Feed writes it.
  • The feed is full of <![CDATA[...]]> wrappers. That is the default and every channel reads it correctly. If you prefer bare values, turn off Wrap XML values in CDATA in Settings and regenerate.
  • The feed is empty or only shows parent products. That is a product-selection issue, not an XML one — check the Filters tab and the Include variations setting in Feed settings.
Try CTX Feed for WooCommerce - Free Download or Upgrade to Pro

Leave a comment.