Skip to content

Instantly share code, notes, and snippets.

@maddisondesigns
Last active October 25, 2023 08:22
Show Gist options
  • Save maddisondesigns/d6230d55a193f031c81722fb621933ea to your computer and use it in GitHub Desktop.
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.
<?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