Commit 33a49931348 for woocommerce

commit 33a499313486aec0b193adec31ee9288354ea703
Author: Luigi Teschio <gigitux@gmail.com>
Date:   Thu Aug 6 11:58:30 2026 +0200

    Restore global wc-blocks compatibility handles (#67365)

    * Fix wc-blocks compatibility handle registration

    * Add changelog entry for wc-blocks compatibility handles

diff --git a/plugins/woocommerce/changelog/fix-wc-blocks-compatibility-handles b/plugins/woocommerce/changelog/fix-wc-blocks-compatibility-handles
new file mode 100644
index 00000000000..fcfb1f07b78
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-wc-blocks-compatibility-handles
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Restore checkout compatibility handling for payment extensions with missing script dependencies.
diff --git a/plugins/woocommerce/src/Blocks/AssetsController.php b/plugins/woocommerce/src/Blocks/AssetsController.php
index 19c880e0f86..9b7c9412994 100644
--- a/plugins/woocommerce/src/Blocks/AssetsController.php
+++ b/plugins/woocommerce/src/Blocks/AssetsController.php
@@ -137,10 +137,7 @@ final class AssetsController {
 			true
 		);

-		if ( is_admin() ) {
-			// Register deprecated script handles for backward compatibility in the admin context.
-			$this->register_deprecated_script_handles();
-		}
+		$this->register_deprecated_script_handles();
 	}

 	/**
@@ -151,32 +148,36 @@ final class AssetsController {
 			'wc-blocks-vendors' => array(),
 			'wc-blocks'         => array( 'wc-blocks-vendors', 'wc-block-library' ),
 		);
-		$build_path          = WC_ABSPATH . 'assets/client/blocks/';
-		$asset_files         = glob( $build_path . '*.asset.php' );

-		foreach ( false === $asset_files ? array() : $asset_files as $asset_file ) {
-			$script_name = basename( $asset_file, '.asset.php' );
+		if ( is_admin() ) {
+			// Discovering legacy block assets requires expensive filesystem checks, so only run this in admin requests.
+			$build_path  = WC_ABSPATH . 'assets/client/blocks/';
+			$asset_files = glob( $build_path . '*.asset.php' );
+
+			foreach ( false === $asset_files ? array() : $asset_files as $asset_file ) {
+				$script_name = basename( $asset_file, '.asset.php' );
+
+				if (
+					in_array( $script_name, array( 'wc-block-library', 'wc-blocks' ), true ) ||
+					! file_exists( $build_path . $script_name . '.js' )
+				) {
+					continue;
+				}

-			if (
-				in_array( $script_name, array( 'wc-block-library', 'wc-blocks' ), true ) ||
-				! file_exists( $build_path . $script_name . '.js' )
-			) {
-				continue;
-			}
+				// The file comes from WooCommerce's generated assets directory, not user input.
+				// nosemgrep audit.php.lang.security.file.inclusion-arg.
+				$asset_data = require $asset_file;

-			// The file comes from WooCommerce's generated assets directory, not user input.
-			// nosemgrep audit.php.lang.security.file.inclusion-arg.
-			$asset_data = require $asset_file;
+				if (
+					! is_array( $asset_data ) ||
+					! in_array( 'wp-blocks', (array) ( $asset_data['dependencies'] ?? array() ), true )
+				) {
+					continue;
+				}

-			if (
-				! is_array( $asset_data ) ||
-				! in_array( 'wp-blocks', (array) ( $asset_data['dependencies'] ?? array() ), true )
-			) {
-				continue;
+				$legacy_handle                         = 'wc-' . $script_name . '-block';
+				$script_dependencies[ $legacy_handle ] = array( 'wc-blocks' );
 			}
-
-			$legacy_handle                         = 'wc-' . $script_name . '-block';
-			$script_dependencies[ $legacy_handle ] = array( 'wc-blocks' );
 		}

 		foreach ( $script_dependencies as $handle => $dependencies ) {