From 82c18633a16d01ec1b6081e3e7c61315fbbf0244 Mon Sep 17 00:00:00 2001 From: magdev Date: Wed, 21 Jan 2026 19:07:43 +0100 Subject: [PATCH] Add WooCommerce feature compatibility declarations Declare compatibility with: - HPOS (High-Performance Order Storage / custom_order_tables) - Cart/Checkout blocks This fixes the WooCommerce admin warning about incompatible plugins. Co-Authored-By: Claude Opus 4.5 --- wc-licensed-product.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/wc-licensed-product.php b/wc-licensed-product.php index 245d36e..daba5f6 100644 --- a/wc-licensed-product.php +++ b/wc-licensed-product.php @@ -92,6 +92,25 @@ function wc_licensed_product_init(): void // Hook into plugins_loaded to ensure WooCommerce is loaded first add_action('plugins_loaded', __NAMESPACE__ . '\\wc_licensed_product_init'); +// Declare WooCommerce feature compatibility +add_action('before_woocommerce_init', function (): void { + if (class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) { + // Declare HPOS compatibility + \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( + 'custom_order_tables', + __FILE__, + true + ); + + // Declare cart/checkout blocks compatibility + \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( + 'cart_checkout_blocks', + __FILE__, + true + ); + } +}); + // Register activation hook register_activation_hook(__FILE__, function (): void { if (!wc_licensed_product_is_woocommerce_active()) {