Skip to main content
Updates / How to Import WooCommerce Orders from XML
← All updates
 
Blog

How to Import WooCommerce Orders from XML

Importing WooCommerce orders from XML requires correctly mapping customer details, purchased products, and order details so that each order is recreated accurately.

XML files can contain nested line items inside each order. An XML importer must correctly interpret these relationships to recreate the original orders in WooCommerce.

In this guide, we’ll show you how to import WooCommerce orders directly from XML, verify the results, and keep imported orders updated when the source file changes.

Why XML Suits WooCommerce Order Data

A WooCommerce order works like a container. The order itself has a date, a status, and a customer, and inside it sit any number of products, fees, coupons, shipping lines, and refunds. XML stores data the same way, as elements nested inside other elements, so each order arrives as one self-contained record.

Here’s a trimmed order from the XML file I use for testing:

xml

<order>

  <order_id>1001</order_id>

  <status>completed</status>

  <customer_email>[email protected]</customer_email>

  <items>

    <item>

      <sku>HOODIE-001</sku>

      <quantity>1</quantity>

      <line_total>45.00</line_total>

    </item>

    <item>

      <sku>MUG-002</sku>

      <quantity>2</quantity>

      <line_total>24.00</line_total>

    </item>

  </items>

  <order_total>81.40</order_total>

</order>

Both products live inside the order they belong to. A flat CSV file will have to approximate this either by packing all items into a single cell or by repeating the order’s details on a new row for each product.

 XMLCSV
Multiple line itemsSeparate <item> elementsDelimited cell or repeated rows
Fees, coupons, refundsTheir own nested groupsExtra columns per entry
Order-to-item linkBuilt into the structureInferred from shared values
Empty valuesEmpty elementsEmpty cells

WP All Import reads any XML structure, so your file can keep the element names and nesting that your source system already exports. We’ll use it for the rest of this guide.

Before You Import Your Orders

An order depends on records that already exist in your WooCommerce store, so a few minutes of setup will save you from having to rerun the import later. I check these before every order import:

  • Import products and customers first. WP All Import links each order’s line items to existing products by SKU, ID, or title, and attaches each order to a matching customer account. If those records aren’t on the site yet, line items arrive without a product link, and customers need a guest fallback.
  • Turn on taxes if your orders include them. Go to WooCommerce › Settings › General and enable tax rates and calculations. Otherwise, tax lines in the XML won’t show on the imported orders.
  • Match your shipping methods. The shipping method names in your file should match a shipping method that exists in WooCommerce, such as Flat rate or Free shipping.
  • Back up your database. Order imports write to several tables at once, and a backup makes a test run safe to undo.

Importing orders requires WP All Import Pro with the WooCommerce Import Add-On. WP All Import supports WooCommerce’s High-Performance Order Storage (HPOS), so the import works with whichever storage mode your store uses.

Import Orders with Automatic Setup

Automatic Setup is the quickest way to get an order XML file into WooCommerce, and it’s where I start every new order import. WP All Import’s Automatic Setup reads your XML file, recognizes each order record, and maps its status, dates, customer details, and order information to WooCommerce order fields automatically. It also decides how each order connects to your customers, which is the part of order imports that usually takes the longest to configure manually.

For this walkthrough, I imported an XML export of 132 orders.

Step 1: Upload Your Order XML File

Go to All Import › New Import and click Set up automatically at the top of the screen.

wp-all-import-new-import-set-up-automatically.

Under Step 1: Select Your Import File, add your WooCommerce orders XML file from your computer, a URL, an existing file on the server, or an FTP/SFTP location. The uploader takes XML, CSV, JSON, TXT, ZIP, and GZ files up to 256 MB, so you can upload a compressed order export without unpacking it first.

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

Step 2: Select WooCommerce Orders

Under Step 2: Choose What to Import, click WooCommerce, then Orders. There is an Add Setup Instructions field, which is optional, and most order exports don’t need it. It’s useful when your file uses vague element names. For example, you can add a short note explaining that ref holds the order number.

wp-all-import-automatic-setup-product-import-type-selection

Click Start Automatic Setup. A consent prompt pops up and explains what Automatic Setup sends to configure the import. Click I Understand, Continue.

Step 3: Review the Order Field Mappings

Within seconds, Your Import Is Ready shows a summary of the finished setup. My file came back with 81 fields mapped and 132 records ready to import, one record per order.

wp-all-import-automatic-setup-import-ready-screen

Expand Field Mappings to see exactly which XML element feeds each WooCommerce order field.

For my XML import file, Automatic Setup matched each order to an existing customer based on the billing email. It also enabled guest matching and mapped every billing field twice: once for the customer and once for a guest. This ensures that if an order’s email doesn’t belong to any account on a site, the order still imports as a complete guest order. It isn’t skipped.

Step 4: Preview the Imported Orders

Click Preview to see a sample order the way WooCommerce will display it. The WP Admin View tab renders the order on WooCommerce’s Edit order screen, with the date, status, linked customer account, billing and shipping addresses, and payment method filled in.

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

Use the record counter to step through the orders and check a few that matter to you, such as guest orders or orders from different date ranges.

Step 5: Run the Order Import

Click Run Import. When the run finishes, the summary shows how many orders were Created, Updated, and Skipped. On a first import into a store, every order should appear under Created. My run created all 132 orders, with none updated or skipped.

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

Open WooCommerce › Orders to see the imported orders alongside the rest of your store’s history. They keep their original dates and statuses, so they sort into the list exactly where they belong.

Fine-Tune Order Details in Manual Setup

WP All Import’s Automatic Setup gets an order import running, but a few settings depend on how you run your store. You might want to have your products matched by ID instead of SKU, or guest orders handled differently. For those decisions, click Manual Setup instead of Run Import on the Your Import Is Ready screen. WP All Import carries every Automatic Setup mapping into the drag-and-drop editor, so you change only the settings you want to and leave the rest as they are.

wp-all-import-woocommerce-orders-manual-setup

Choose How Line Items Find Their Products

Automatic Setup already links each line item to the matching product in your catalog. The Products tab under Order Items lets you decide how that match is made. In Existing Product Identifier, choose SKU, ID, or product title, whichever your XML file holds most reliably. 

A line item with no match still imports with its name and price, but it won’t link to a product. Totals behave the same predictable way: WP All Import imports order totals exactly as they appear in your file and doesn’t recalculate them, so imported orders match the source system to the cent.

Keep Customer Emails Switched Off

Under Import Settings, Block email notifications during import is selected by default. Keep it that way for historical orders. Turn it off only if the orders in your XML file are new and your customers should hear about them, such as orders arriving from a marketplace feed.

wp-all-import-block-email-notifications-import-settings-for-woocommerce-orders

Keep Imported Orders Up to Date

Many order imports aren’t one-off jobs. Marketplaces and ERPs keep generating new orders and updating the status of old ones, so the same XML feed would need to be imported again and again. WP All Import updates existing WooCommerce orders on every re-run, matching each record to the order it created before, so changed orders get updated rather than arrive as duplicates.

That matching depends on the unique identifier, which WP All Import detects automatically, and you can set to your file’s order ID. On each run, you choose what happens to the orders in your file: create the new ones, update the ones that changed, or remove any that no longer appear.

wp-all-import-import-settings-record-matching-options

For a feed that changes daily, point the import at the file’s URL instead of an uploaded copy. Then put it on a schedule using Automatic Scheduling, so new and updated orders arrive without anyone having to re-run the import manually.

Final Thoughts

Importing WooCommerce orders from XML comes down to getting every part of each order into the right place. WP All Import does that with Automatic Setup, which automatically maps each order’s status, date, billing details, line items, and totals to WooCommerce. It links every line item to the matching product in your catalog and every order to an existing customer by billing email, with a guest fallback for unmatched buyers. WP All Import imports order totals exactly as they appear in the source file, so imported orders match the original system to the cent.

My advice is to start with a small sample of your XML file, run it through Automatic Setup, and check a few finished orders in WooCommerce before importing the full data. Once the results look right, the same import can run again on a schedule. WP All Import updates existing orders by their unique identifier on every run, so a store fed by a marketplace or ERP stays current without duplicate orders or manual re-entry.

Frequently Asked Questions

Can WooCommerce import orders on its own?

No. WooCommerce’s built-in importer handles products only, so importing orders needs a plugin. WP All Import imports WooCommerce orders from XML, CSV, and other file formats, bringing over each order’s status, date, customer, line items, and totals. Its Automatic Setup feature maps those fields for you.

How do I import an XML file into WooCommerce?

You can import any XML file into WooCommerce with WP All Import, whether it holds products, orders, customers, or coupons:

  1. Go to All Import › New Import and click Set up automatically.
  2. Upload your XML file, or pull it in with Download from URL, Existing File, or FTP/SFTP.
  3. Click WooCommerce, then choose the type of data in your file, such as Orders or Products.
  4. Click Start Automatic Setup, then I Understand, Continue.
  5. Review the mappings on the Your Import Is Ready screen and click Run Import.

How do I migrate WooCommerce orders to another site?

WP All Export and WP All Import migrate WooCommerce orders between sites in a few steps:

  1. On the old site, go to All Export › New Export and select WooCommerce Orders.
  2. Choose Migrate Orders and download the bundle file.
  3. On the new site, go to All Import › New Import and upload the bundle file.
  4. WP All Import configures the import from the bundle automatically. Run it and check the migrated orders under WooCommerce › Orders.

For the full process, see How to Migrate WooCommerce Orders.

How do I update existing WooCommerce orders with an import?

To update existing WooCommerce orders, re-run the original import in WP All Import with the updated file. WP All Import matches each order to the one it created before by its unique identifier, so changed orders update in place and don’t duplicate. Go to All Import › Manage Imports, open the import’s settings, and choose to update existing orders when they appear in the file again. Then run the import with the new version of your XML file. Orders that changed are updated, new orders are created, and you can choose to delete orders that no longer appear in the file.

Further Reading

Get Oxygen

Build it your way with Oxygen.

$199.50 once — unlimited sites, no renewal

Not per year, not per site, not per seat. 60 day money back guarantee.