Skip to content

Instantly share code, notes, and snippets.

@helgatheviking
Created November 8, 2024 17:39
Show Gist options
  • Save helgatheviking/d7823e4ecd2f7c2978c32ce0bf051a05 to your computer and use it in GitHub Desktop.
Save helgatheviking/d7823e4ecd2f7c2978c32ce0bf051a05 to your computer and use it in GitHub Desktop.
Add this snippet to your plugin's main file to declare compatibility with Woo "Features"
/**
* Declare Features compatibility.
*/
add_action( 'before_woocommerce_init', function() {
if ( ! class_exists( 'Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
return;
}
// HPOS (Custom Order tables) compatibility.
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', plugin_basename( __FILE__ ), true );
// Cart and Checkout Blocks.
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', plugin_basename( __FILE__ ), true );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment