From eff5e2990572cb86f8a1a864ae0d82acf8617d45 Mon Sep 17 00:00:00 2001 From: Luigi Date: Fri, 18 Aug 2023 12:15:32 +0200 Subject: [PATCH] load Interactivity API in Bootstrap.php file --- src/Domain/Bootstrap.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Domain/Bootstrap.php b/src/Domain/Bootstrap.php index 09b7efd9fc4..bbbadfb663f 100644 --- a/src/Domain/Bootstrap.php +++ b/src/Domain/Bootstrap.php @@ -100,6 +100,7 @@ public function __construct( Container $container ) { protected function init() { $this->register_dependencies(); $this->register_payment_methods(); + $this->load_interactivity_api(); // This is just a temporary solution to make sure the migrations are run. We have to refactor this. More details: https://github.com/woocommerce/woocommerce-blocks/issues/10196. if ( $this->package->get_version() !== $this->package->get_version_stored_on_db() ) { @@ -225,6 +226,21 @@ function() { ); } + /** + * Load and set up the Interactivity API if enabled. + */ + protected function load_interactivity_api() { + // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment + $is_enabled = apply_filters( + 'woocommerce_blocks_enable_interactivity_api', + true + ); + + if ( $is_enabled ) { + require_once '../Interactivity/load.php'; + } + } + /** * Register core dependencies with the container. */