Implement WooCommerce High-Performance Order Storage (HPOS) compatibility for a custom plugin that queries order data via direct database queries

domain: WooCommerce HPOS · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Audit the existing plugin for any direct wpdb queries against wp_posts or wp_postmeta that reference order post types, and list all raw SQL order data access patterns
  2. Replace direct post meta queries with WooCommerce CRUD methods using wc_get_order(), $order->get_meta(), and the WooCommerce Orders data store abstraction layer
  3. Declare HPOS compatibility in the plugin by hooking into the woocommerce_feature_compatibility method and calling FeaturesUtil::declare_compatibility with the custom_order_tables feature
  4. Use WooCommerce's wc_get_orders() with the appropriate args array instead of get_posts() or WP_Query with post type shop_order for any order list queries
  5. Test the plugin in a staging environment with HPOS enabled and the compatibility mode (sync) turned on, verifying order creation, retrieval, and meta updates work correctly via the HPOS tables
  6. Run WooCommerce's built-in HPOS migration to move existing orders to the custom order tables, monitoring for migration errors on orders with non-standard meta structures

Known gotchas

Related routes

Make a WooCommerce integration compatible with High-Performance Order Storage (HPOS)
woocommerce.com · 6 steps · unrated
Sync products and orders with WooCommerce REST API
woocommerce · 4 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans