wc-hpos-compatibility

Declare WooCommerce HPOS compatibility and migrate order data access to HPOS backends.

21|1|Updated Apr 29, 2026
One-click install
npx skills add https://github.com/Lonsdale201/wp-agent-skills --skill wc-hpos-compatibility
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wc-hpos-compatibility
Source: https://github.com/Lonsdale201/wp-agent-skills/tree/main/woocommerce/wc-hpos-compatibility
Command: npx skills add https://github.com/Lonsdale201/wp-agent-skills --skill wc-hpos-compatibility

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill guides plugin authors through declaring WooCommerce HPOS compatibility and adapting order data access to the HPOS backend to avoid breaking changes on WC 10.x.

Core Features & Use Cases

  • Declare compatibility with FeaturesUtil::declare_compatibility on before_woocommerce_init to enable HPOS support flags.
  • Use the WC Object model (wc_get_order, WC_Order::get_meta, update_meta_data, save) and wc_get_orders for all order CRUD and queries; avoid direct get_post_meta / WP_Query against orders.
  • Detect runtime mode with OrderUtil helpers and properly branch admin hooks and screens for HPOS vs legacy CPT to maintain compatibility during migration or sync-mode.
  • Prepare admin UI hooks and meta-box patterns using OrderUtil to ensure consistent screen handling across modes.

Quick Start

Declare HPOS compatibility using FeaturesUtil::declare_compatibility in the before_woocommerce_init hook and refactor all order interactions to wc_get_order, WC_Order::get_meta, and wc_get_orders.

Frequently Asked Questions about wc-hpos-compatibility

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I declare HPOS compatibility for a WooCommerce plugin?

Declare HPOS compatibility by calling FeaturesUtil::declare_compatibility within the before_woocommerce_init hook to enable support flags and prevent breaking changes on WC 10.x.

What is the best way to migrate WooCommerce order data access to HPOS?

Migrate order data access by replacing direct get_post_meta and WP_Query with WooCommerce abstractions like wc_get_order, WC_Order methods, and wc_get_orders for all CRUD operations.

Do I need OrderUtil to detect WooCommerce HPOS runtime mode?

You need OrderUtil helpers to detect runtime mode and properly branch admin hooks and screens, maintaining compatibility across HPOS and legacy CPT during migration or sync-mode.

Why does my WooCommerce plugin break when HPOS is enabled?

Plugins break because HPOS moves orders away from the posts table; fixing it requires refactoring direct database queries to use WooCommerce object models and HPOS data stores.

Can I use get_post_meta with WooCommerce orders in HPOS mode?

Direct get_post_meta calls fail in HPOS mode; you must use WC_Order::get_meta, update_meta_data, and save methods to interact with order data stored in custom tables.

How to handle admin UI hooks for WooCommerce HPOS and legacy CPT orders?

Handle admin UI hooks by leveraging OrderUtil to ensure consistent screen handling and meta-box patterns across both HPOS and legacy CPT modes.