How to Migrate WooCommerce Orders

To migrate WooCommerce orders, go to the source/export site and navigate to WP All Export › New Export, then select WooCommerce Orders and follow the steps to migrate the orders. Once done, navigate to WP All Import › New Import on the destination/import site and upload the bundle file to migrate WooCommerce orders.

Step 1: New Export Bundle to Migrate WooCommerce Orders

To migrate WooCommerce orders, navigate to All Export › New Export in the export site, then select WooCommerce Orders from the dropdown list. WP All Export will show the number of orders available to export.

To define which export columns to include in the export, click on Customize Export File. Otherwise, to migrate everything, click on Migrate Orders.

Migrate WooCommerce Orders New Export Bundle

If you only want to migrate certain orders, you can add filtering rules using Add Filtering Options.

Step 2: Run Export to Migrate WooCommerce Orders

If you clicked on Customize Export File, you can build your export file:

Migrate WooCommerce Orders Build Export File

Once done, or if you clicked to Migrate Orders, you will see the Export Settings screen, where you can define Scheduling Options or change the available Advanced Options.

As with most migrations, you can leave these export settings alone and use their default selections. Click on Confirm & Run Export to continue and run the export.

Migrate WooCommerce Orders Export Settings

Once the export is complete, proceed to download the Bundle file under Click to Download.

Migrate WooCommerce Orders Export Complete

This bundle file helps make the import process quick and simple, as it contains all exported WooCommerce orders along with a settings file to configure WP All Import automatically.

Step 3: Migrate WooCommerce Orders using the Import Bundle

In the import site, navigate to All Import › New Import and upload the previously obtained bundle file.

Click on Skip to Step 4 so the bundle file maps everything automatically. However, if you want to change the mappings, click on Continue to Step 2 and then click Continue after modifying the import mapping (not shown).

Migrate WooCommerce Orders New Import

Now you see the Import Settings screen. Here, you can unblock email notifications for customers (which are blocked by default), define Scheduling Options, or Configure Advanced Settings.

With most migrations, you don't need to modify these settings, so you can leave everything as is.

To carry on, click Continue at the bottom.

Migrate WooCommerce Orders Import Settings

Click Confirm & Run Import on the following screen (not shown).

Once the import completes, you will see an Import Complete! message:

Migrate WooCommerce Orders Import Complete

The migration is now complete! All WooCommerce orders were migrated from the origin site and duplicated on the destination site.

Step 4: Confirm Migrated WooCommerce Orders

Once the migration is done, you can review that all the WooCommerce orders are correctly imported by checking in WooCommerce. To do so, navigate to WooCommerce › Orders on the import site.

Migrate WooCommerce Orders View Migrated Orders

If you don't see all of the orders in that list, you should review the migration steps explained above and make sure that all instructions were followed correctly.

If some orders were migrated and some were skipped, you can review the advanced topics below to understand why some orders get skipped.

As a last resort, you can remove everything that was migrated and re-start the migration process from scratch.

Migrate WooCommerce Orders – Advanced Topics

Migrated Order Skipped Due to Customer Match Not Found

Out of the box, this shouldn't happen because the bundle migration file is configured to import as a guest customer if there's no match found:

Migrate WooCommerce Orders Import Guest Customer

However, you'll find the following message in the History Logs if that setting is disabled and there's no match with an existing customer:

[22:31:02] SKIPPED: Search customer by email `[email protected]`. Existing customer not found for Order `Order – June 18, 2022 @ 02:43 AM`.

In that case, you can solve the problem by making sure that there's a correct match with the order customer, or that the If no match found, import as guest customer option is enabled and all fields are filled in.

Migrated Order Skipped Due to Product Match Not Found

To ensure that the WooCommerce order migration is successful, the WooCommerce products should also exist on the import site and have a valid SKU. This is because orders are matched with existing products using the SKU.

Migrate WooCommerce Orders Product SKU

If not all products exist, you can also migrate them. To learn how to do so, see below How Do I Migrate WooCommerce Products?.

If you don't want to migrate the WooCommerce products, you can also manually import the product data to the imported order. Just enable Manually import product order data and do not try to match to existing products option and fill in the fields:

Migrate WooCommerce Orders Manually Import Products

If you do want to migrate your products but they don't have an SKU, you can temporarily generate one using a workaround:

  • First, while importing your products, add a custom field "_old_id" containing the product's ID. We use the product ID to generate a random SKU.
Migrate WooCommerce Orders Old Product SKU
  • Second, import your orders and use the following custom PHP function in the Product SKU field. Here's the code:
 //Usage example: [my_connect_orders({productid[1]})]

function my_connect_orders( $product_id ) {
    global $wpdb;
    $query = 'SELECT `post_id` FROM `' . $wpdb->prefix . 'postmeta` WHERE `meta_key` = "_old_id" AND `meta_value` = "' . $product_id . '"';

				if ( $product = $wpdb->get_row( $query ) ) {
					$random_sku = md5( $product->post_id );
					if ( $wc_product = wc_get_product( $product->post_id ) ) {
						$wc_product->set_sku( $random_sku );
						$wc_product->save();
						return $random_sku;
					}
				}
}
  • Here's how it looks:
Migrate WooCommerce Orders Use Function
  • Third, add the following code in order to clean the temporary SKUs:

function remove_auto_generated_sku($post_id, $xml_node, $is_update)
{
     global $wpdb;
    $query = 'SELECT `post_id` FROM `' . $wpdb->prefix . 'postmeta` WHERE `meta_key` = "_old_id" AND `meta_value` = "' . $xml_node->productid . '"';
	
		if ( $product = $wpdb->get_row( $query )  ) {
        $random_sku = md5( $product->post_id );
		if ( $wc_product = wc_get_product( $product->post_id ) ) {
			$current_sku = $wc_product->get_sku();
			if ($current_sku == $random_sku) {
            		$wc_product->set_sku( '' );
            		$wc_product->save();
						}
				}
        
    }	
}

add_action('pmxi_saved_post', 'remove_auto_generated_sku', 10, 3);

To make sure that this import works, set the records per iteration to 1 in your WooCommerce order's import settings: 

Migrate WooCommerce Orders Records Per Iteration

Add both code snippets to the Function Editor (All Import › Settings Function Editor) or in a plugin like Code Snippets.

Frequently Asked Questions

Can I Link My Migrated Orders to My Products and Customers?

As long as you follow the correct sequence, yes. Migrate your products and customers first, then migrate your orders. When you follow this sequence, you can use WP All Import's advanced toolset to link your WooCommerce orders to your products and customers.

Can I Migrate All WooCommerce Order Data, Even Custom Fields Added by Other Plugins?

Yes. WP All Import and WP All Export automatically recognize the custom data fields created by most plugins and extensions. The only exception is if a plugin stores its data in a nonstandard way. In this is the case, just contact our support staff for further guidance.

How Does Your Plugin Differ From Other Plugins That Migrate WooCommerce Orders?

Other plugins migrate your database and overwrite the data on your import site. Our plugin gives you far more control. If you wish, you can configure it to overwrite only the data that you want to overwrite. It even allows you to modify that data while importing or exporting it.

How Do I Synchronize WooCommerce Order Data Between Sites?

  1. Install WP All Export in the export site and generate an export bundle file with your desired WooCommerce orders.
  2. Install WP All Import in the import site and import the bundle file from Step 1.
  3. Set up both the export and import to run automatically using cron jobs or our Automatic Scheduling Service. Given that this is an asynchronous schedule, the export should occur before the import happens.
  4. Make sure to test this process before putting it into production.

Note, if you also need to synchronize customers and products, you will need to repeat the above process for them, as well. You will also need to follow the recommended sequence of synchronizing customers and products before orders.

How to Export Orders from WooCommerce?

  1. Navigate to All Export › New Export and choose the export post type of WooCommerce Orders.
  2. Use our Drag & Drop interface to configure your export columns.
  3. Run the export.
  4. Download your export file.

To learn more, see How to Export WooCommerce Orders to CSV, Excel, or XML.

How to Import Orders Into WooCommerce?

  1. Navigate to All Import › New Import.
  2. Select the method for importing your orders (i.e., upload file, use a URL, etc.).
  3. Choose an import file and your import target (i.e., WooCommmerce Orders).
  4. Map the incoming data elements to the WooCommerce order fields using our Drag & Drop interface.
  5. Run the import.

See How to Import WooCommerce Orders for more information.

Relevant Videos

Related Docs

Shows how to import variable WooCommerce products using WP All Import.

Learn how to export WooCommerce products using WP All Export.

Shows how to import WooCommerce customers into WooCommerce.

Learn how to export WooCommerce customers out of WooCommerce.

Lifetime support. Lifetime updates. Pay once.

Packages
Standalone
Import
Pro Package
$249
one-time
  • Import Pro
Import Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
  • Types
  • Export Pro
Export Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
Add to Cart
90 Day Money Back Guarantee
Import + Export Pro Package
$299
one-time
  • Import Pro
Import Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
  • Types
  • Export Pro
Export Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
Add to Cart
90 Day Money Back Guarantee
WooCommerce Import Package
$149
one-time
  • Import Pro
Import Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
  • Types
  • Export Pro
Export Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
Add to Cart
90 Day Money Back Guarantee
Import Standalone
$99
one-time
  • Import Pro
Import Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
  • Types
  • Export Pro
Export Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
Add to Cart
90 Day Money Back Guarantee
Import + Export Standalone
$169
one-time
  • Import Pro
Import Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
  • Types
  • Export Pro
Export Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
Add to Cart
90 Day Money Back Guarantee
Export Standalone
$99
one-time
  • Import Pro
Import Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
  • Types
  • Export Pro
Export Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
Add to Cart
90 Day Money Back Guarantee
cross