Commit c1ac4269b01 for woocommerce
commit c1ac4269b01c3d57d563d1b90549e0d9d66a6a79
Author: Poli Gilad <83961704+poligilad-auto@users.noreply.github.com>
Date: Tue May 19 12:18:17 2026 +0200
Reorder Product Data tabs when variations classic redesign is on (#65108)
* Reorder Product Data tabs when variations classic redesign is enabled
Variations becomes the entry point for variation attribute management in
the new design, so move it above Attributes (priority 60 -> 40). Linked
Products shifts below Attributes (priority 40 -> 60) to keep the rest of
the sidebar coherent. When the feature flag is off, ordering is unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* improve logic
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
diff --git a/plugins/woocommerce/changelog/reorder-product-data-tabs-redesign b/plugins/woocommerce/changelog/reorder-product-data-tabs-redesign
new file mode 100644
index 00000000000..2417fa89927
--- /dev/null
+++ b/plugins/woocommerce/changelog/reorder-product-data-tabs-redesign
@@ -0,0 +1,4 @@
+Significance: minor
+Type: tweak
+
+Reorder Product Data tabs to put Variations above Attributes when the product variations classic redesign feature is enabled.
diff --git a/plugins/woocommerce/src/Admin/Features/ProductVariationsClassicRedesign/Init.php b/plugins/woocommerce/src/Admin/Features/ProductVariationsClassicRedesign/Init.php
index 588a5e71035..295251798ea 100644
--- a/plugins/woocommerce/src/Admin/Features/ProductVariationsClassicRedesign/Init.php
+++ b/plugins/woocommerce/src/Admin/Features/ProductVariationsClassicRedesign/Init.php
@@ -25,6 +25,7 @@ class Init {
}
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 20 );
+ add_filter( 'woocommerce_product_data_tabs', array( $this, 'handle_woocommerce_product_data_tabs' ), 5 );
}
/**
@@ -44,6 +45,26 @@ class Init {
// phpcs:enable WordPress.Security.NonceVerification
}
+ /**
+ * Handle the woocommerce_product_data_tabs filter.
+ *
+ * @internal
+ *
+ * @param array $tabs Product data tabs.
+ * @return array Product data tabs.
+ */
+ public function handle_woocommerce_product_data_tabs( array $tabs ): array {
+ if ( isset( $tabs['variations'] ) && is_array( $tabs['variations'] ) ) {
+ $tabs['variations']['priority'] = 40;
+ }
+
+ if ( isset( $tabs['linked_product'] ) && is_array( $tabs['linked_product'] ) ) {
+ $tabs['linked_product']['priority'] = 60;
+ }
+
+ return $tabs;
+ }
+
/**
* Enqueue scripts and styles for the variations table.
*/