You've already forked wc-licensed-product
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 <noreply@anthropic.com>
This commit is contained in:
@@ -92,6 +92,25 @@ function wc_licensed_product_init(): void
|
|||||||
// Hook into plugins_loaded to ensure WooCommerce is loaded first
|
// Hook into plugins_loaded to ensure WooCommerce is loaded first
|
||||||
add_action('plugins_loaded', __NAMESPACE__ . '\\wc_licensed_product_init');
|
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
|
||||||
register_activation_hook(__FILE__, function (): void {
|
register_activation_hook(__FILE__, function (): void {
|
||||||
if (!wc_licensed_product_is_woocommerce_active()) {
|
if (!wc_licensed_product_is_woocommerce_active()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user