Commit f2fd1573927 for woocommerce
commit f2fd1573927919004065e0a717a4a8314119e942
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date: Mon Aug 10 13:40:14 2026 +0200
Update checks to install themes from the onboarding (#67522)
* Update checks to install themes from the onboarding
* Add changelog
* Remove blank line
diff --git a/plugins/woocommerce/changelog/fix-WOO6-75 b/plugins/woocommerce/changelog/fix-WOO6-75
new file mode 100644
index 00000000000..0f855931558
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-WOO6-75
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Update theme onboarding checks
diff --git a/plugins/woocommerce/src/Admin/API/OnboardingThemes.php b/plugins/woocommerce/src/Admin/API/OnboardingThemes.php
index 10622ad335c..46c0c310a51 100644
--- a/plugins/woocommerce/src/Admin/API/OnboardingThemes.php
+++ b/plugins/woocommerce/src/Admin/API/OnboardingThemes.php
@@ -41,7 +41,7 @@ class OnboardingThemes extends \WC_REST_Data_Controller {
array(
'methods' => \WP_REST_Server::EDITABLE,
'callback' => array( $this, 'install_theme' ),
- 'permission_callback' => array( $this, 'update_item_permissions_check' ),
+ 'permission_callback' => array( $this, 'install_item_permissions_check' ),
),
'schema' => array( $this, 'get_item_schema' ),
)
@@ -61,6 +61,21 @@ class OnboardingThemes extends \WC_REST_Data_Controller {
);
}
+ /**
+ * Check if a given request has access to install themes.
+ *
+ * @param \WP_REST_Request<array<string, mixed>> $request Full details about the request.
+ * @return \WP_Error|bool
+ *
+ * @since 11.0.1
+ */
+ public function install_item_permissions_check( $request ) {
+ if ( ! current_user_can( 'install_themes' ) ) {
+ return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot install themes.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
+ }
+ return true;
+ }
+
/**
* Check if a given request has access to manage themes.
*