diff --git a/plugins/woocommerce/changelog/update-51953 b/plugins/woocommerce/changelog/update-51953 new file mode 100644 index 00000000000..6f4cb75eb4f --- /dev/null +++ b/plugins/woocommerce/changelog/update-51953 @@ -0,0 +1,4 @@ +Significance: patch +Type: performance + +Limit loading product block editor to admin pages and rest requests diff --git a/plugins/woocommerce/src/Admin/Features/ProductBlockEditor/Init.php b/plugins/woocommerce/src/Admin/Features/ProductBlockEditor/Init.php index 7e274815e91..ab7c0ee3741 100644 --- a/plugins/woocommerce/src/Admin/Features/ProductBlockEditor/Init.php +++ b/plugins/woocommerce/src/Admin/Features/ProductBlockEditor/Init.php @@ -3,6 +3,8 @@ * WooCommerce Product Block Editor */ +declare(strict_types = 1); + namespace Automattic\WooCommerce\Admin\Features\ProductBlockEditor; use Automattic\WooCommerce\Admin\Features\Features; @@ -49,6 +51,10 @@ class Init { * Constructor */ public function __construct() { + if ( ! is_admin() && ! WC()->is_rest_api_request() ) { + return; + } + array_push( $this->supported_product_types, 'variable' ); array_push( $this->supported_product_types, 'external' ); array_push( $this->supported_product_types, 'grouped' );