Question: Best practices for testing WooCommerce HPOS compatibility? #67086
|
Hi WooCommerce community, I am currently learning about High Performance Order Storage (HPOS) and want to make sure my plugins and custom code are compatible before enabling it on a production store. I understand that HPOS changes how WooCommerce stores order data by moving away from the traditional WordPress posts/postmeta tables, but I would like to know the recommended testing workflow. A few questions: What is the best way to check whether an existing plugin or custom code is HPOS compatible? Any advice, examples, or recommended documentation would be appreciated. Thanks! |
Replies: 1 comment
|
Hi @hiSoft1129 , you've got the core concept right already, so most of the groundwork is done. Taking your questions in order. WooCommerce does the first compatibility pass for you: under WooCommerce > Settings > Advanced > Features, the HPOS section lists any active plugins that declare themselves incompatible, and In your own code, the usual offenders are direct calls like To find stray queries, enable HPOS with compatibility mode (the setting that keeps orders synced to the posts table) on staging. Anything writing to the legacy tables directly shows up as a data mismatch, and And yes, staging first is the right call. Turn on compatibility mode, let the sync finish, run with both tables for a while, and only make the HPOS tables authoritative on production once The docs cover all of this in more depth: https://developer.woocommerce.com/docs/features/orders/high-performance-order-storage/ Recipe book (includes a regex for auditing your code): https://developer.woocommerce.com/docs/features/orders/high-performance-order-storage/recipe-book/ One note on venue: this repo's issues and discussions are mainly for WooCommerce core development. For setup and store-level questions like this, you'll get more eyes on the community forum: https://wordpress.org/support/plugin/woocommerce/ |
Hi @hiSoft1129 , you've got the core concept right already, so most of the groundwork is done. Taking your questions in order.
WooCommerce does the first compatibility pass for you: under WooCommerce > Settings > Advanced > Features, the HPOS section lists any active plugins that declare themselves incompatible, and
wp wc hpos compatibility-infogives you the same list from WP-CLI. One thing to keep in mind: this only catches plugins that declare their status, so a plugin that never declares anything still needs a manual look.In your own code, the usual offenders are direct calls like
get_post_meta()orupdate_post_meta()with an order ID,get_posts()orWP_Queryon theshop_orderpost t…