From f5602c4a615a9a4fce4c1f100f803a71c6115b7a Mon Sep 17 00:00:00 2001 From: Alex Florisca Date: Mon, 10 Oct 2022 11:59:33 +0100 Subject: [PATCH] Add compatibility with HPOS (custom order tables) for WooCommerce --- woocommerce-gutenberg-products-block.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/woocommerce-gutenberg-products-block.php b/woocommerce-gutenberg-products-block.php index a613da5ccbd..767b275a943 100644 --- a/woocommerce-gutenberg-products-block.php +++ b/woocommerce-gutenberg-products-block.php @@ -15,7 +15,7 @@ * @package WooCommerce\Blocks * @internal This file is only used when running as a feature plugin. */ - + defined( 'ABSPATH' ) || exit; $minimum_wp_version = '6.0'; @@ -23,6 +23,14 @@ if ( ! defined( 'WC_BLOCKS_IS_FEATURE_PLUGIN' ) ) { define( 'WC_BLOCKS_IS_FEATURE_PLUGIN', true ); } + +// Declare comaptibility with custom order tables for WooCommerce +if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) { + add_action('before_woocommerce_init', function() { + \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, true); + }); +} + /** * Whether notices must be displayed in the current page (plugins and WooCommerce pages). *