Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kish2011/b3dba5c2750a9a618fd96145e7ba2812 to your computer and use it in GitHub Desktop.
Save kish2011/b3dba5c2750a9a618fd96145e7ba2812 to your computer and use it in GitHub Desktop.
Declare HPOS compatibility in your WooCommerce plugin. Add this code to your main plugin file.
<?php
/**
* Declare WooCommerce HPOS compatibility
*/
function yourplugin_declare_hpos_compat() {
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
}
}
add_action( 'before_woocommerce_init', 'yourplugin_declare_hpos_compat' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment