Skip to main content
Blog/How to Import WooCommerce Products From an XML File

How to Import WooCommerce Products From an XML File

Importing WooCommerce products from XML requires identifying the XML elements that represent individual products and mapping their values to the correct WooCommerce fields. This is challenging because XML files can contain nested categories, attributes, and other product data, and their structures vary between suppliers and platforms.

WP All Import can automatically import WooCommerce products straight from XML, so the file goes in exactly as your supplier or old platform sent it. To see how that holds up, we ran a 35-product XML file through Automatic Setup. It found the record element and mapped the SKUs, prices, stock, and categories on its own, leaving us nothing to fix before the import ran.

Why WooCommerce Can’t Import XML on Its Own

WooCommerce has shipped with a product importer since version 3.1, but that importer reads CSV files only. It won’t accept a product XML file, so store owners have to convert the file before WooCommerce will take it.

That conversion takes more than a few minutes in a spreadsheet. XML stores product data in nested elements, so a single record can carry a full category path and a set of attributes alongside its price and stock. Here’s a trimmed record from the XML file we tested:

xml

<post>

  <Title>Red Circle Dog Tag from Brightdog</Title>

  <Sku>2</Sku>

  <RegularPrice>10.46</RegularPrice>

  <Stock>7</Stock>

  <StockStatus>instock</StockStatus>

  <Productcategories><![CDATA[Circle>Red]]></Productcategories>

  <AttributeNamepa_color>Color</AttributeNamepa_color>

  <AttributeValuepa_color>red</AttributeValuepa_color>

</post>

To fit that into a CSV, every nested value gets flattened into a single cell, and the columns have to suit WooCommerce’s importer. When the next XML file arrives, the conversion starts over.

WP All Import removes that conversion step entirely. It imports WooCommerce products from XML files directly, and each element can be mapped to a WooCommerce product field without having to reshape the file.

How XML Product Data Maps to WooCommerce Fields

Every element in a product XML file has a home in WooCommerce’s product editor. Knowing where each one goes makes the import easier to check afterward, because you know exactly which tab to open. Here’s where the elements from our test file ended up:

XML elementWhere it lands in WooCommerce
TitleProduct name
ContentProduct description
ShortDescriptionProduct short description
RegularPrice, SalePriceGeneral tab, price fields
Sku, ManageStock, Stock, StockStatusInventory tab
WeightShipping tab
AttributeName… / AttributeValue…Attributes tab
ProductcategoriesProduct categories
FeaturedProduct image
DatePublish date

WP All Import works with whatever element names an XML file uses. For example, <Sku> and <RegularPrice> import as they are, without renaming them to match WooCommerce’s internal field names first.

How We Import WooCommerce Products From XML With Automatic Setup

Automatic Setup is the fastest route from a product XML file to a working WooCommerce import in WP All Import. It reads the file and maps its elements to WooCommerce product fields, then leaves you a finished import to review before a single product is created. We ran our 35-product test file through it without having to map one field by hand.

Step 1: Upload the XML File

In your WordPress dashboard, go to All Import › New Import and click Set up automatically at the top of the screen. The Upload File tab takes XML files up to 256 MB, along with CSV, JSON, and ZIP or GZ archives.

A product XML file that lives on a supplier’s server doesn’t need downloading first. The Download from URL and FTP/SFTP tabs pull it in directly, and Existing File reuses one you’ve uploaded before.

wp-all-import-automatic-setup-select-import-file

Step 2: Choose WooCommerce Products

Under What would you like to import?, select WooCommerce, then Products. This one option covers simple, variable, and grouped products, so an XML file that mixes product types still runs as a single import. Click Start Automatic Setup, then I Understand, Continue on the data-processing notice.

wp-all-import-automatic-setup-select-woocommerce-product-import-type

Step 3: Check the Field Mappings

The Your Import Is Ready screen shows what Automatic Setup found. Our file came back with 87 fields mapped and 35 records ready to import. Compare that record count with the number of products in your file. A match means WP All Import picked the right repeating element, which in our file was <post>.

Expand Field Mappings to see each assignment. Automatic Setup set Product Type and Manage Stock with XPath, so each product takes its own values from the file rather than sharing one setting across all 35.

Below the mappings, a Possible source-site identifiers notice listed Permalink, an element pointing back to the site the file came from. WP All Import flags elements like this so another site’s URLs don’t end up saved on your products.

wp-all-import-automatic-setup-import-ready-field-mappings-expanded

Step 4: Preview the Products

Click Preview. Frontend View shows each product the way shoppers will see it, and WP Admin View opens its edit screen. Page through all 35 records with the arrows at the top right.

Our first record, the Red Circle Dog Tag, displayed its price, stock count, short description, image, and categories exactly as described in the XML file.

wp-all-import-automatic-setup-preview-frontend-view.

Step 5: Run the Import and Check the Results

Click Run Import. When it finishes, WP All Import reports how many products it created, updated, and skipped. Our run created all 35 products with none skipped. The imported products also kept the publish dates from the file’s <Date> element, so your catalog’s history carries over.

wp-all-import-automatic-setup-import-complete

Fine-Tuning the XML Import in Manual Setup

XML files exported from another system often carry the same value twice under slightly different names. Every record in our test file had both <Sku> and <SKU>, and both <Price> and <Price2>.

XML element names are case-sensitive, so WP All Import treats <Sku> and <SKU> as two separate elements. When both hold the same value, either one works. When they differ, the field has to point to the right one, or the imported products quietly pick up the wrong SKU or price.

Automatic Setup chose <Sku> for the SKU field in our import. To see which element any field uses, expand Field Mappings on the Your Import Is Ready screen. Each mapping shows its XML element in curly braces, such as {Sku[1]}, where [1] means the first matching element in the record.

To point a field at a different element, click Manual Setup. The template editor opens with every automatic mapping already in place and the current XML record displayed on the right. Clear the field, drag in the element you want, and use the arrows above the record to check a few products before you continue to the import settings.

WP All Import reads every element in an XML record, duplicates included, so any value in the file can be mapped to any WooCommerce product field.

wp-all-import-manual-setup-xml-product-file-mapped-sku

Why Some Products Import Without a SKU

Our first run of the test file created all 35 products, but every SKU in the WooCommerce product list came back blank. The mapping wasn’t at fault, since Automatic Setup had pointed the SKU field at {Sku[1]}.

Each SKU in a WooCommerce store has to be unique, and in our test, products sitting in the Trash still counted. The site held trashed products from an earlier import that shared SKUs with the XML file, so the new products were saved without them.

!
Before you re-import an XML file

Empty the WooCommerce Trash, or permanently delete any old products that share SKUs with the file. Then delete the SKU-less products and run the import again.

Clean SKUs pay off on every import after the first one. When an updated version of the XML file arrives, WP All Import can match each record to its existing WooCommerce product by SKU and update it in place instead of creating a duplicate. Set the matching up under Import Settings in Manual Setup before the second run.

Final Thoughts

An XML product file doesn’t need converting before it reaches WooCommerce. WP All Import imports WooCommerce products directly from XML files, and its Automatic Setup feature maps each XML element to a WooCommerce product field before any product is created. In our test, 35 products went into the store with their prices, stock, categories, and images in place, and none of their fields were mapped manually.

The part that deserves your attention is the checking. Compare the record count with your file, and keep every SKU unique so the next import has something to match against. WP All Import updates existing WooCommerce products from a newer XML file by matching each record’s SKU, which changes the products in place instead of creating duplicates. That’s what makes the first import the start of an ongoing workflow rather than a one-time job.

Common Questions About Importing WooCommerce Products From XML 

Can WooCommerce import XML files?

No. WooCommerce’s built-in product importer accepts CSV files only, so an XML file has to be converted before WooCommerce can use it. WP All Import imports XML files into WooCommerce directly, with no conversion step, and maps each XML element to a WooCommerce product field.

How do I import WooCommerce products from an XML file?

You can import WooCommerce products from an XML file with WP All Import’s Automatic Setup feature:

  1. Go to All Import › New Import and click Set up automatically.
  2. Upload your XML file on the Upload File tab, or pull it in with Download from URL or FTP/SFTP.
  3. Select WooCommerce, then Products, and click Start Automatic Setup.
  4. On the Your Import Is Ready screen, check the record count and expand Field Mappings.
  5. Click Preview to check a few products, then click Run Import.

How do I import variable products from XML into WooCommerce?

To import variable products from XML into WooCommerce, run the XML file through WP All Import’s Automatic Setup and choose WooCommerce › Products as the import type. Automatic Setup reads each record’s product type from the file and links every variation to its parent product, so parent and variation records in one XML file import together. For a full walkthrough, see our guide on how to import WooCommerce variable products.

How do I update existing WooCommerce products with a new XML file?

WP All Import updates existing WooCommerce products from a new XML file by matching each record’s SKU:

  1. Start a new import with Set up automatically and upload the updated XML file.
  2. Select WooCommerce › Products and click Start Automatic Setup.
  3. On the Your Import Is Ready screen, click Manual Setup, then continue to Import Settings.
  4. Select Attempt to match to existing WooCommerce products before creating new ones, and match on the product SKU.
  5. Check Update existing WooCommerce products with changed data in your file.
  6. Run the import and confirm the Updated count matches the number of changed products.

How do I import an XML product feed into WooCommerce?

To import an XML product feed into WooCommerce, start a WP All Import import and choose the Download from URL tab instead of uploading a file. Paste the feed’s URL and click Download. WP All Import fetches the XML and moves on to Automatic Setup the same way it handles an uploaded file. Feeds stored on a server come in through the FTP/SFTP tab, and WP All Import can re-run the import on a schedule to keep your products in step with the feed.

Share
XFBLink