Last active
October 25, 2023 08:22
-
-
Save maddisondesigns/d6230d55a193f031c81722fb621933ea to your computer and use it in GitHub Desktop.
Declare HPOS compatibility in your WooCommerce plugin. Add this code to your main plugin file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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