Commit 3c94bae14f4 for woocommerce

commit 3c94bae14f479d262bd33be8f705fe1d42374476
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date:   Tue Jul 28 09:33:30 2026 +0200

    Prevent notice about wp-editor being enqueued from appearing in the Widgets screen (#66979)

    * Prevent notice about wp-editor being enqueued from appearing in the Widgets screen

    * Add changelog

    * Code cleanup

    * Add changelog (II)

    * Improve expect

    * Linting

diff --git a/packages/js/email-editor/changelog/fix-47831-widget-editor-notice b/packages/js/email-editor/changelog/fix-47831-widget-editor-notice
new file mode 100644
index 00000000000..1a17c425312
--- /dev/null
+++ b/packages/js/email-editor/changelog/fix-47831-widget-editor-notice
@@ -0,0 +1,5 @@
+Significance: patch
+Type: fix
+Comment: Remove dependency on @wordpress/editor from useIsEmailEditor()
+
+
diff --git a/packages/js/email-editor/src/hooks/use-is-email-editor.ts b/packages/js/email-editor/src/hooks/use-is-email-editor.ts
index 2870f90c8b9..c7772110bf7 100644
--- a/packages/js/email-editor/src/hooks/use-is-email-editor.ts
+++ b/packages/js/email-editor/src/hooks/use-is-email-editor.ts
@@ -2,7 +2,6 @@
  * External dependencies
  */
 import { useSelect } from '@wordpress/data';
-import { store as editorStore } from '@wordpress/editor';

 /**
  * Internal dependencies
@@ -10,6 +9,13 @@ import { store as editorStore } from '@wordpress/editor';
 import { storeName } from '../store';
 import { EmailTemplate } from '../store/types';

+/**
+ * Store name of the WordPress editor store.
+ * Using a hardcoded string allows us to avoid the import.
+ * See: https://github.com/woocommerce/woocommerce/issues/47831
+ */
+const CORE_EDITOR_STORE = 'core/editor';
+
 /**
  * Hook to detect if we are currently in the email editor context.
  *
@@ -28,14 +34,19 @@ export function useIsEmailEditor(): boolean {
 			return false;
 		}

+		// Get the current post information from the WordPress editor when available.
+		const editorSelectors = select( CORE_EDITOR_STORE );
+		if ( ! editorSelectors ) {
+			return false;
+		}
+
+		const currentPostId = editorSelectors.getCurrentPostId();
+		const currentPostType = editorSelectors.getCurrentPostType();
+
 		// Get the email editor store's post information
 		const emailPostId = emailEditorStore.getEmailPostId();
 		const emailPostType = emailEditorStore.getEmailPostType();

-		// Get the current post information from the WordPress editor
-		const currentPostId = select( editorStore ).getCurrentPostId();
-		const currentPostType = select( editorStore ).getCurrentPostType();
-
 		// Check if the current post matches the email editor post
 		const currentPostMatch =
 			String( currentPostId ) === String( emailPostId ) &&
diff --git a/plugins/woocommerce/changelog/fix-47831-widget-editor-notice b/plugins/woocommerce/changelog/fix-47831-widget-editor-notice
new file mode 100644
index 00000000000..39678460cd6
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-47831-widget-editor-notice
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Prevent notice about wp-editor being enqueued from appearing in the Widgets screen
diff --git a/plugins/woocommerce/client/blocks/assets/js/atomic/utils/register-product-block-type.ts b/plugins/woocommerce/client/blocks/assets/js/atomic/utils/register-product-block-type.ts
index 2861a65d227..dd55107c1a7 100644
--- a/plugins/woocommerce/client/blocks/assets/js/atomic/utils/register-product-block-type.ts
+++ b/plugins/woocommerce/client/blocks/assets/js/atomic/utils/register-product-block-type.ts
@@ -11,7 +11,7 @@ import {
 	BlockConfiguration,
 } from '@wordpress/blocks';
 import { subscribe, select } from '@wordpress/data';
-import { store as editorStore } from '@wordpress/editor';
+import { CORE_EDITOR_STORE } from '@woocommerce/utils';
 import { isEmpty } from '@woocommerce/types';

 /**
@@ -106,7 +106,7 @@ export class BlockRegistrationManager {

 		// Main store subscription to detect which editor we're in
 		const unsubscribe = subscribe( () => {
-			const editorSelectors = select( editorStore );
+			const editorSelectors = select( CORE_EDITOR_STORE );

 			// Return if editor store is not available yet
 			if ( ! editorSelectors ) {
@@ -160,7 +160,7 @@ export class BlockRegistrationManager {
 					if ( previousTemplateId !== this.currentTemplateId ) {
 						this.handleTemplateChange( previousTemplateId );
 					}
-				}, editorStore );
+				}, CORE_EDITOR_STORE );

 				this.initialized = true;
 			}
diff --git a/plugins/woocommerce/tests/e2e/utils/blocks/admin/index.ts b/plugins/woocommerce/tests/e2e/utils/blocks/admin/index.ts
index c10470b96dd..d4dbde2d4b9 100644
--- a/plugins/woocommerce/tests/e2e/utils/blocks/admin/index.ts
+++ b/plugins/woocommerce/tests/e2e/utils/blocks/admin/index.ts
@@ -34,6 +34,11 @@ export class Admin extends CoreAdmin {
 		const closeWelcomeGuide = this.page
 			.getByRole( 'dialog', { name: 'Welcome to block Widgets' } )
 			.getByRole( 'button', { name: 'Close' } );
+
+		// Verify the wp-editor script wasn't loaded.
+		// See: https://github.com/woocommerce/woocommerce/issues/47831
+		await expect( this.page.locator( '#wp-editor-js' ) ).toHaveCount( 0 );
+
 		// The welcome guide only shows when it hasn't been dismissed before, so
 		// wait for it briefly and close it only when it actually appears.
 		const guideAppeared = await closeWelcomeGuide