From 8e5325e11f6e99d30783b7adba25d5a3c9a24980 Mon Sep 17 00:00:00 2001 From: Thomas Roberts Date: Tue, 14 Feb 2023 17:00:19 +0000 Subject: [PATCH] Check for wc-blocks before checking payment dependencies --- src/Payments/Api.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Payments/Api.php b/src/Payments/Api.php index bc6a5a65ef2..3f37184a63d 100644 --- a/src/Payments/Api.php +++ b/src/Payments/Api.php @@ -123,6 +123,11 @@ public function register_payment_method_integrations( PaymentMethodRegistry $pay * an error in the admin. */ public function verify_payment_methods_dependencies() { + // Check that the wc-blocks script is registered before continuing. Some extensions may cause this function to run + // before the payment method scripts' dependencies are registered. + if ( ! wp_script_is( 'wc-blocks', 'registered' ) ) { + return; + } $wp_scripts = wp_scripts(); $payment_method_scripts = $this->payment_method_registry->get_all_active_payment_method_script_dependencies();