Declare compatibility with custom order tables for WooCommerce

/**
 * Declares compatibility with "High-Performance Order Storage (HPOS)".
 *
 * @see https://wpcodebook.com/snippets/declare-compatibility-with-custom-order-tables-for-woocommerce/
 * @see https://github.com/woocommerce/woocommerce/wiki/High-Performance-Order-Storage-Upgrade-Recipe-Book#declaring-extension-incompatibility
 */
add_action( 'before_woocommerce_init', function () {
	if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
		\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
	}
}

The code goes to the main plugin file.

Leave a Comment