Skip to content
ThemesIonic — home
Troubleshooting

WooCommerce Historical Data Import Not Working

WooCommerce Analytics does not read your orders directly. It reads lookup tables built from them, and the historical import fills those tables through Action Scheduler, so a stuck import is almost always a stuck queue.

Updated 5 min read intermediate

Quick fix: if Analytics › Settings › Import historical data shows "Status: Importing Customers" or "Importing Orders" and the progress bar never moves, open WooCommerce › Status › Scheduled Actions, search for wc-admin_import and look at the Pending actions. If their scheduled times are in the past, the import is fine. Your site is just not running background tasks.

What the import actually does

Analytics reports never query orders directly. They read lookup tables (wc_order_stats, product, coupon and tax lookups, wc_customer_lookup). Start in the "Import historical data" section queues work in the Action Scheduler group wc-admin-data:

Hook Job
wc-admin_import_batch_init_customers Counts registered customers and queues batches
wc-admin_import_batch_customers Imports one batch of customers
wc-admin_import_batch_init_orders Counts orders and refunds; waits for the customer init to finish
wc-admin_import_batch_orders Imports one batch of orders (25 per batch)
wc-admin_queue_batches_* Splits large jobs into batches

The status line reflects that order. Initializing means the totals are not known yet, then Importing Customers, Importing Orders, Finalizing, and finally "All historical data imported" (or "Historical data from YYYY-MM-DD onward imported" for a limited period). "Nothing To Import" means the count came back as zero for the period you chose.

Symptom → where to look → fix

What you see Where to look Fix
Stuck on Initializing or Importing Customers, 0 progress Scheduled Actions → Pending, search wc-admin_import Queue not running. Past-due pending actions mean WP-Cron or the async runner is not firing, see Action Scheduler past-due actions.
Progress moves, then stops for good Scheduled Actions → Failed, open the log column A batch threw an error (timeout, memory, a broken order). Fix the cause, then re-import with Skip previously imported customers and orders.
"%d orders failed to import. View the log for details." WooCommerce › Status › Logs, source wc-analytics-order-import (batch errors: wc-analytics-import) Use Retry failed imports. Above the 1,000-ID cap, run the import again with the skip box ticked.
"An import is already in progress…" Scheduled Actions → Pending / In-progress, group wc-admin-data Let it finish, or use Stop Import ("Imported data will not be lost if the import is stopped.")
"Something went wrong with the importation process." Browser console and the REST response for /wc-analytics/reports/import Usually a REST or permissions problem, not the queue.
Import finished, report empty or low Analytics › Settings: Excluded statuses, Date type See "Finished but wrong" below.
Registered customers count looks too small User roles Only the customer role is imported as registered customers (filter woocommerce_analytics_import_customer_roles). Guests come in through their orders.
WooCommerce Analytics Settings, Import historical data: Imported Orders and Refunds 0 of 3, Status: Importing Orders with a spinner, and a Stop Import button.
Reproduced on WordPress 7.1.5 with WooCommerce 11.3.1 on a server that could not run background requests: the import stays at 0 of 3 indefinitely.

On that test install the queue held exactly two pending actions in the wc-admin-data group, wc-admin_import_batch_orders and wc-admin_process_pending_orders_batch. Running them by hand finished the import:

$ wp action-scheduler run --group=wc-admin-data
Completed processing action 31 with hook: wc-admin_import_batch_orders
1 batch executed.

$ wp db query "SELECT COUNT(*) FROM wp_wc_order_stats"
3

After a reload the section showed "Status: Nothing To Import" and a Delete Previously Imported Data button: the three orders were in Analytics.

When the queue is not running

Pending actions with times in the past affect every plugin that uses Action Scheduler, not just Analytics. The usual causes:

  • Loopback requests fail. Action Scheduler starts its async runner with a request back to your own site. Check Tools › Site Health; the fixes are in loopback request failed.
  • DISABLE_WP_CRON is set with no real server cron calling wp-cron.php.
  • A backlog. Tens of thousands of pending actions from another plugin sit in front of the import. Compare the total Pending count with what the wc-admin_import search returns.

You can process the queue by hand with Run on a pending row in Scheduled Actions. That proves the action works. It does not fix the runner.

When batches fail

A failed batch logs the order ID and the exception, then rethrows, so Action Scheduler marks that action Failed. Orders after it in the same batch are not imported. Common causes are a PHP timeout or memory exhaustion on long order histories (see increasing the memory limit), or an order record created by a migration tool that bypassed WooCommerce. Open the order named in the log in the admin. If it does not display properly there, the import cannot read it either.

If WooCommerce also shows a pending database update, run that first. It uses the same queue and may be changing the data the import reads, see database update not working.

Finished but wrong

  • Excluded statuses default to Pending payment, Cancelled and Failed. Refunded cannot be excluded.
  • Date type defaults to Date paid. An on-hold order still waiting for a bank transfer has no paid date, so it matches no date range. Switch to Date created to see it.
  • The report's date range may start after your history. Widen it.
  • Test-mode orders from WooPayments are skipped on purpose (filter woocommerce_analytics_is_test_order).
  • Order storage. The import reads whichever storage is authoritative, either High-performance order storage or posts. If orders exist only in the other one after an unfinished migration, they are not counted. Finish the sync first.

Re-importing cleanly

Clicking import again on a stalled run adds work without fixing why it stopped. Once the cause is fixed:

  1. Back up the database, as described in backing up WordPress.
  2. Click Delete Previously Imported Data and wait until the delete actions finish.
  3. Choose All (or a period), leave Skip previously imported customers and orders unticked, and click Start.

To fill gaps without deleting anything, tick the skip box instead. Each batch then only takes orders that have no wc_order_stats row yet.

This tool only summarises orders already in WooCommerce. Moving orders between stores is a different job, covered in exporting WooCommerce orders.

Verify

  1. The status reads "All historical data imported", and searching wc-admin_import shows no Pending or Failed rows.
  2. A month with known revenue matches the order list filtered to the same dates and statuses, using the same Date type.
  3. A new test order appears after the next scheduled batch (default every 12 hours), or within minutes if Updates is set to Immediately.

Frequently asked

Check three settings under Analytics › Settings before blaming the import. Excluded statuses defaults to Pending payment, Cancelled and Failed. Date type defaults to Date paid, so unpaid orders have no date to match. And the report's own date range must include the orders. A finished import with excluded or unpaid orders looks exactly like a failed one.
On newer stores the Updates setting defaults to Scheduled (recommended). New and changed orders are then processed by a recurring background batch, every 12 hours by default, rather than straight away. Switch Updates to Immediately if you need live figures and the store is not busy, or wait for the next batch.
Yes. The analytics tables are derived from your orders and customers, so Delete Previously Imported Data removes nothing original. Reports stay incomplete until the new import finishes, so avoid doing it in the middle of a reporting period.

Related guides