From a23b2cf415ee90c2a1c46f80c99e4d7e2f12fe7e Mon Sep 17 00:00:00 2001 From: Fernando Marichal Date: Tue, 7 Mar 2023 18:04:17 -0300 Subject: [PATCH] Fix duplicated global attribute (#37109) * Add fix * Add changelog --------- Co-authored-by: Fernando Marichal --- .../changelog/fix-37020_duplicated_global_attribute | 4 ++++ .../client/legacy/js/admin/meta-boxes-product.js | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 plugins/woocommerce/changelog/fix-37020_duplicated_global_attribute diff --git a/plugins/woocommerce/changelog/fix-37020_duplicated_global_attribute b/plugins/woocommerce/changelog/fix-37020_duplicated_global_attribute new file mode 100644 index 00000000000..a698ac0c2d5 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-37020_duplicated_global_attribute @@ -0,0 +1,4 @@ +Significance: minor +Type: fix + +Fix duplicated global attribute diff --git a/plugins/woocommerce/client/legacy/js/admin/meta-boxes-product.js b/plugins/woocommerce/client/legacy/js/admin/meta-boxes-product.js index 754bbedd6b7..835c141afba 100644 --- a/plugins/woocommerce/client/legacy/js/admin/meta-boxes-product.js +++ b/plugins/woocommerce/client/legacy/js/admin/meta-boxes-product.js @@ -652,9 +652,15 @@ jQuery( function ( $ ) { attribute_row_indexes(); } + $parent.remove(); + if ( ! $( '.woocommerce_attribute_data' ).is( ':visible' ) && - ! $( 'div.add-global-attribute-container' ).hasClass( 'hidden' ) + ! $( 'div.add-global-attribute-container' ).hasClass( + 'hidden' + ) && + $( '.product_attributes' ).find( 'input, select, textarea' ) + .length === 0 ) { toggle_add_global_attribute_layout(); }