Commit 9943b079999 for woocommerce

commit 9943b07999924e17350cb7b50d67fb7ef584bce6
Author: Jorge A. Torres <jorge.torres@automattic.com>
Date:   Fri Mar 20 22:32:16 2026 +0000

    Ensure cart/checkout blocks preview correctly in all post block editors (#63759)

diff --git a/plugins/woocommerce/changelog/wooplug-5024-cart-block-data-missing-in-custom-editors b/plugins/woocommerce/changelog/wooplug-5024-cart-block-data-missing-in-custom-editors
new file mode 100644
index 00000000000..98d12b0b3f3
--- /dev/null
+++ b/plugins/woocommerce/changelog/wooplug-5024-cart-block-data-missing-in-custom-editors
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Fix Cart and Checkout block editor detection for post-new.php and other custom editor contexts.
diff --git a/plugins/woocommerce/client/blocks/assets/js/data/utils/is-editor.ts b/plugins/woocommerce/client/blocks/assets/js/data/utils/is-editor.ts
index 585266e250b..80993187243 100644
--- a/plugins/woocommerce/client/blocks/assets/js/data/utils/is-editor.ts
+++ b/plugins/woocommerce/client/blocks/assets/js/data/utils/is-editor.ts
@@ -2,6 +2,7 @@
  * External dependencies
  */
 import { getPath } from '@wordpress/url';
+import { select } from '@wordpress/data';

 /**
  * Returns true if the current page is in the editor.
@@ -10,6 +11,7 @@ export const isEditor = (): boolean => {
 	return (
 		getPath( window.location.href )?.includes( 'site-editor.php' ) ||
 		getPath( window.location.href )?.includes( 'post.php' ) ||
+		!! select( 'core/editor' ) ||
 		false
 	);
 };
diff --git a/plugins/woocommerce/client/blocks/tests/js/config/global-mocks.js b/plugins/woocommerce/client/blocks/tests/js/config/global-mocks.js
index a0118483c8d..0cd157dbf9f 100644
--- a/plugins/woocommerce/client/blocks/tests/js/config/global-mocks.js
+++ b/plugins/woocommerce/client/blocks/tests/js/config/global-mocks.js
@@ -368,3 +368,12 @@ if ( ! window.DOMRect ) {
 jest.mock( 'client-zip', () => ( {
 	downloadZip: jest.fn(),
 } ) );
+
+/**
+ * Mock isEditor to return false by default in tests, since the core/editor
+ * store may be registered in the test environment without an actual editor
+ * context. Individual tests can override this mock if needed.
+ */
+jest.mock( '../../../assets/js/data/utils/is-editor', () => ( {
+	isEditor: jest.fn().mockReturnValue( false ),
+} ) );