WooCommerce Analytics tax lookup migration

This reference explains the WooCommerce 11.2.0 change to Analytics tax lookup records and the Rebuild analytics tax data tool in WooCommerce > Status > Tools. Use it to confirm the migration state and investigate an order that could not be rebuilt. It does not recommend direct database edits.

Note:

This is a Developer level doc. If you are unfamiliar working with code and resolving potential conflicts, we recommend you work with a Woo Agency Partner for larger projects, or find a WooCommerce developer on Codeable for smaller customizations. We are unable to provide support for customizations under our Support Policy.

Before you start

↑ Back to top
  • Use WooCommerce 11.2.0 or later.
  • Sign in with an account that can access WooCommerce > Status > Tools. WooCommerce checks the manage_woocommerce capability for this screen.
  • For report-level verification, open Analytics > Taxes.

What changed in the tax lookup table

↑ Back to top

Before WooCommerce 11.2.0, the wc_order_tax_lookup table could hold one row for an order and tax rate, even when the order had multiple tax lines with that rate. The 11.2.0 schema adds order_item_id and includes it in the table’s primary key: (order_id, tax_rate_id, order_item_id). New synchronization writes one row per tax order item, so Analytics can account for every tax line.

When WooCommerce adds the column to an existing table, its default value is 0. Those older rows keep reporting as they did before the change until the background rebuild has processed their order. The report query can read both the older row shape and the rebuilt per-line rows during that period.

Automatic migration and tool states

↑ Back to top

The WooCommerce 11.2.0 database update queues a background migration. It re-syncs orders that still have old-shaped tax lookup rows. The tool appears at WooCommerce > Status > Tools and reports how many orders remain. The displayed count is capped at 1000+ when there are at least 1,000 pending orders.

  • Rebuild: Starts the background process when eligible orders remain.
  • Stop rebuilding: Removes the queued process. Orders already processed stay rebuilt; orders not yet processed remain eligible to continue later.
  • No orders to rebuild: The tool is disabled when it finds no pending orders. This status does not rule out an order that was recorded as a failed Analytics import; check Analytics > Settings for failed imports.
  • Missing database change: The tool is disabled if the table is not keyed by tax order item. Run Verify base database tables, return to the Tools page, and check the tool again.

Verify the result

↑ Back to top
  1. On the Tools page, confirm that the rebuild no longer reports orders to process.
  2. In Analytics > Settings, retry any failed Analytics imports related to the migration.
  3. In Analytics > Taxes, review orders that contain multiple tax lines using the same rate. Confirm their tax totals are represented once per tax line and that the report still opens after the rebuild.

For reader-facing report fields and unavailable taxable amounts, see the Taxes Report. The Installed Database Tables reference lists WooCommerce’s Analytics lookup tables.

When an order does not rebuild

↑ Back to top

If a lookup read or write fails while WooCommerce re-syncs an order, it keeps that order’s existing tax lookup rows and records the order as a failed Analytics import. Retry the import from Analytics > Settings; that retry re-syncs the order’s tax data. For the tool’s reader-facing states, see the System Tools documentation.

For server-side investigation, search the WooCommerce logs for the source wc-order-tax-lookup-migration. Do not change the lookup rows or the migration cursor directly. If the table schema is missing its tax order item key, use Verify base database tables before attempting the rebuild again.

Questions and support

↑ Back to top

Do you still have questions and need assistance? 

This documentation is about the free, core WooCommerce plugin, for which support is provided in our community forums on WordPress.org. By searching this forum, you’ll often find that your question has been asked and answered before.

If you haven’t created a WordPress.org account to use the forums, here’s how.

  • If you’re looking to extend the core functionality shown here, we recommend reviewing available extensions in the WooCommerce Marketplace.
  • Need ongoing advanced support or a customization built for WooCommerce? Hire a Woo Agency Partner.
  • Are you a developer building your own WooCommerce integration or extension? Check our Developer Resources.

If you weren’t able to find the information you need, please use the feedback thumbs below to let us know.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.