From 609fe044506d756a394594e8d6079c2be62a7192 Mon Sep 17 00:00:00 2001
From: Sebastian Pisula <sebastian.pisula@gmail.com>
Date: Thu, 27 Oct 2022 17:57:55 +0200
Subject: [PATCH] feature(core): Added Compatibility with WooCommerce
 High-Performance Order Storage (HPOS)

---
 CHANGELOG.md            | 4 ++++
 lang/.gitignore         | 4 ----
 src/PluginBootstrap.php | 9 +++++++++
 3 files changed, 13 insertions(+), 4 deletions(-)
 delete mode 100644 lang/.gitignore

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2d79b2c..69837a4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## [1.1.0] - 2022-10-02
+### Added
+- Compatibility with WooCommerce High-Performance Order Storage (HPOS)
+
 ## [1.0.4] - 2022-05-25
 ### Fixed
 - Added missing `wpdesk/wp-wpdesk-tracker` library
diff --git a/lang/.gitignore b/lang/.gitignore
deleted file mode 100644
index 06e1972..0000000
--- a/lang/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*
-!.gitignore
-!pl_PL.po
-!index.php
\ No newline at end of file
diff --git a/src/PluginBootstrap.php b/src/PluginBootstrap.php
index 521bceb..9d02c62 100644
--- a/src/PluginBootstrap.php
+++ b/src/PluginBootstrap.php
@@ -115,6 +115,15 @@ final class PluginBootstrap {
 			},
 			self::PRIORITY_BEFORE_FLOW_2_5
 		);
+
+		add_action(
+			'before_woocommerce_init',
+			static function () use ( $plugin_info ) {
+				if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
+					\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', $plugin_info->get_plugin_file_name(), true );
+				}
+			}
+		);
 	}
 
 	/**
-- 
GitLab