From 3f7c3e517d7bf13008a22d0c2eb89434a9c35ae7 Mon Sep 17 00:00:00 2001 From: Seghir Nadir Date: Thu, 30 Sep 2021 12:42:07 +0100 Subject: [PATCH] Don't fire woocommerce_blocks_loaded if WC version is not met (#4873) --- src/Domain/Bootstrap.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Domain/Bootstrap.php b/src/Domain/Bootstrap.php index 654e63478de..1b2b21812c4 100644 --- a/src/Domain/Bootstrap.php +++ b/src/Domain/Bootstrap.php @@ -58,20 +58,19 @@ class Bootstrap { public function __construct( Container $container ) { $this->container = $container; $this->package = $container->get( Package::class ); - $this->init(); - /** - * Usable as a safe event hook for when the plugin has been loaded. - */ - do_action( 'woocommerce_blocks_loaded' ); + if ( $this->has_core_dependencies() ) { + $this->init(); + /** + * Usable as a safe event hook for when the plugin has been loaded. + */ + do_action( 'woocommerce_blocks_loaded' ); + } } /** * Init the package - load the blocks library and define constants. */ protected function init() { - if ( ! $this->has_core_dependencies() ) { - return; - } $this->register_dependencies(); $this->register_payment_methods();