Commit 4b13c69a9bf for woocommerce

commit 4b13c69a9bf39ff9c4e769633622cb5cc15da397
Author: Lucio Giannotta <lucio.giannotta@a8c.com>
Date:   Thu Nov 26 01:23:27 2026 +0100

    Restore admin tab panels rendered outside their tab container (#71160)

diff --git a/plugins/woocommerce/changelog/fix-extension-admin-tab-panels b/plugins/woocommerce/changelog/fix-extension-admin-tab-panels
new file mode 100644
index 00000000000..448195a1c8e
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-extension-admin-tab-panels
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Restore extension product and coupon tabs whose panels appear outside the standard tab container.
diff --git a/plugins/woocommerce/client/legacy/changelog/fix-extension-admin-tab-panels b/plugins/woocommerce/client/legacy/changelog/fix-extension-admin-tab-panels
new file mode 100644
index 00000000000..448195a1c8e
--- /dev/null
+++ b/plugins/woocommerce/client/legacy/changelog/fix-extension-admin-tab-panels
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Restore extension product and coupon tabs whose panels appear outside the standard tab container.
diff --git a/plugins/woocommerce/client/legacy/js/admin/meta-boxes.js b/plugins/woocommerce/client/legacy/js/admin/meta-boxes.js
index 4f458a1ce4c..796685443bc 100644
--- a/plugins/woocommerce/client/legacy/js/admin/meta-boxes.js
+++ b/plugins/woocommerce/client/legacy/js/admin/meta-boxes.js
@@ -140,21 +140,13 @@ jQuery( function ( $ ) {
 				return ( $tab.attr( 'href' ) || '' ).replace( /^#/, '' );
 			};

-			const get_tab_panel = function ( $tab, $panel_wrap ) {
+			const get_tab_panel = function ( $tab ) {
 				const target_id = get_tab_target_id( $tab );
 				if ( ! target_id ) {
 					return $();
 				}

-				const $panel = $( document.getElementById( target_id ) );
-				if (
-					$panel.length &&
-					$.contains( $panel_wrap.get( 0 ), $panel.get( 0 ) )
-				) {
-					return $panel;
-				}
-
-				return $();
+				return $( document.getElementById( target_id ) );
 			};

 			const maybe_update_panel_tabindex = function ( $panel ) {
@@ -197,7 +189,7 @@ jQuery( function ( $ ) {
 							.attr( 'aria-selected', 'false' )
 							.attr( 'tabindex', '-1' );

-						const $panel = get_tab_panel( $tab, $panel_wrap );
+						const $panel = get_tab_panel( $tab );
 						if ( $panel.length ) {
 							$panel
 								.attr( 'role', 'tabpanel' )
@@ -212,7 +204,7 @@ jQuery( function ( $ ) {
 					return;
 				}
 				const $panel_wrap = $tab.closest( 'div.panel-wrap' );
-				const $panel = get_tab_panel( $tab, $panel_wrap );
+				const $panel = get_tab_panel( $tab );
 				if ( ! $panel.length ) {
 					return;
 				}
@@ -220,7 +212,10 @@ jQuery( function ( $ ) {
 				$panel_wrap.find( 'ul.wc-tabs li' ).removeClass( 'active' );
 				$panel_wrap.find( 'ul.wc-tabs a[role="tab"]' )
 					.attr( 'aria-selected', 'false' )
-					.attr( 'tabindex', '-1' );
+					.attr( 'tabindex', '-1' )
+					.each( function () {
+						get_tab_panel( $( this ) ).hide();
+					} );

 				$tab.parent().addClass( 'active' );
 				$tab.attr( 'aria-selected', 'true' ).attr( 'tabindex', '0' );