Search code examples
databasewordpresswoocommercesettingsorders

How to run WooCommerce HPOS sync again for previously synced orders?


I synced my orders with HPOS Sync via Woocommerce Settings > Advanced > Features page but didn’t switch to HPOS and did not check – Enable compatibility mode (synchronizes orders to the posts table) option.

Due to this, post & postmeta tables and HPOS tables are out of sync again as after initial sync, only postmeta and post tables were updated as compatibility mode was not enabled.

How to re-sync the previously synced orders that have become out of sync as postmeta was updated after initial sync?


Solution

  • How to re-sync legacy orders to High Performance Orders Storage

    First, always make a database backup.

    Go to WooCommerce Settings > Advanced > Features > Order data storage (section):

    Enable only "WordPress posts storage (legacy)" option, and save.

    enter image description here

    Go to WooCommerce Status > Tools > Delete the custom orders tables (section):

    Click on the delete button.

    enter image description here

    Go back to WooCommerce Settings > Advanced > Features > Order data storage (section):

    Click on "Sync XXX pending orders" link

    enter image description here

    Then click on "Enable compatibility mode (synchronizes orders to the posts table)", and save.

    Now the WooCommerce Action Scheduler will sync orders by batch, each hour.

    Once done, you can switch to "High-performance order storage (recommended)" option and save.