Commit b311f5a6c35 for woocommerce
commit b311f5a6c3594bac6b939be7183c87d42fe32fc6
Author: Anand Rajaram <anandrajaram21@gmail.com>
Date: Mon Oct 19 15:45:57 2026 +0530
Fix localized decimals in product Quick Edit (#68065)
* Fix localized decimals in product Quick Edit
* Add changelog entry for Quick Edit decimal fix
* Add Quick Edit measurement localization tests
* Simplify Quick Edit measurement field mock
* Simplify tests
---------
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
diff --git a/plugins/woocommerce/changelog/fix-41286-quick-edit-decimal-separator b/plugins/woocommerce/changelog/fix-41286-quick-edit-decimal-separator
new file mode 100644
index 00000000000..738eb8fd996
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-41286-quick-edit-decimal-separator
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Localize product weight and dimensions in Quick Edit.
diff --git a/plugins/woocommerce/client/legacy/js/admin/quick-edit.js b/plugins/woocommerce/client/legacy/js/admin/quick-edit.js
index 86d94b95722..d050f67674e 100644
--- a/plugins/woocommerce/client/legacy/js/admin/quick-edit.js
+++ b/plugins/woocommerce/client/legacy/js/admin/quick-edit.js
@@ -79,10 +79,10 @@ jQuery(
setTimeout( function() {
init_sale_datepickers( $( '#edit-' + post_id ) );
}, 0 );
- $( 'input[name="_weight"]', '.inline-edit-row' ).val( weight );
- $( 'input[name="_length"]', '.inline-edit-row' ).val( length );
- $( 'input[name="_width"]', '.inline-edit-row' ).val( width );
- $( 'input[name="_height"]', '.inline-edit-row' ).val( height );
+ $( 'input[name="_weight"]', '.inline-edit-row' ).val( weight.replace( '.', woocommerce_admin.decimal_point ) );
+ $( 'input[name="_length"]', '.inline-edit-row' ).val( length.replace( '.', woocommerce_admin.decimal_point ) );
+ $( 'input[name="_width"]', '.inline-edit-row' ).val( width.replace( '.', woocommerce_admin.decimal_point ) );
+ $( 'input[name="_height"]', '.inline-edit-row' ).val( height.replace( '.', woocommerce_admin.decimal_point ) );
$( 'select[name="_shipping_class"] option:selected', '.inline-edit-row' ).attr( 'selected', false ).trigger( 'change' );
$( 'select[name="_shipping_class"] option[value="' + shipping_class + '"]' ).attr( 'selected', 'selected' )
diff --git a/plugins/woocommerce/client/legacy/js/admin/test/quick-edit.test.js b/plugins/woocommerce/client/legacy/js/admin/test/quick-edit.test.js
new file mode 100644
index 00000000000..b667acdf08a
--- /dev/null
+++ b/plugins/woocommerce/client/legacy/js/admin/test/quick-edit.test.js
@@ -0,0 +1,65 @@
+describe( 'Product Quick Edit measurements', () => {
+ let $;
+
+ beforeAll( () => {
+ // jQuery binds document-ready callbacks on a timer once the document is loaded.
+ jest.useFakeTimers();
+ jest.resetModules();
+
+ $ = require( 'jquery' );
+ global.jQuery = $;
+ global.inlineEditPost = { revert: jest.fn() };
+ global.woocommerce_admin = { decimal_point: '.' };
+ global.woocommerce_quick_edit = { strings: { allow_reviews: '' } };
+
+ document.body.innerHTML = `
+ <table>
+ <tbody id="the-list">
+ <tr id="post-1">
+ <td><button type="button" class="editinline"></button></td>
+ </tr>
+ </tbody>
+ </table>
+ <div id="woocommerce_inline_1">
+ <div class="weight">1.25</div>
+ <div class="length">2.50</div>
+ <div class="width">3.75</div>
+ <div class="height">4.00</div>
+ </div>
+ <div class="inline-edit-row">
+ <input name="_weight">
+ <input name="_length">
+ <input name="_width">
+ <input name="_height">
+ </div>
+ `;
+
+ require( '../quick-edit' );
+ jest.runAllTimers();
+ jest.useRealTimers();
+ } );
+
+ afterAll( () => {
+ document.body.innerHTML = '';
+ delete global.jQuery;
+ delete global.inlineEditPost;
+ delete global.woocommerce_admin;
+ delete global.woocommerce_quick_edit;
+ } );
+
+ test.each( [
+ [ ',', '1,25', '2,50', '3,75', '4,00' ],
+ [ '.', '1.25', '2.50', '3.75', '4.00' ],
+ ] )(
+ 'populates measurements when the decimal separator is %s',
+ ( decimalPoint, weight, length, width, height ) => {
+ global.woocommerce_admin.decimal_point = decimalPoint;
+ $( '.editinline' ).trigger( 'click' );
+
+ expect( document.querySelector( 'input[name="_weight"]' ).value ).toBe( weight );
+ expect( document.querySelector( 'input[name="_length"]' ).value ).toBe( length );
+ expect( document.querySelector( 'input[name="_width"]' ).value ).toBe( width );
+ expect( document.querySelector( 'input[name="_height"]' ).value ).toBe( height );
+ }
+ );
+} );