Commit 967a32bfd4e for woocommerce
commit 967a32bfd4e50807548a0bc617b8a42a823a17cc
Author: Tung Du <dinhtungdu@gmail.com>
Date: Thu Sep 10 17:16:27 2026 +0700
Fix invalid input clearing variation sale prices (#68534)
* fix: reject zero variation sale price adjustments
* chore: add changelog for zero variation adjustment fix
* fix: preserve invalid variation adjustments for validation
* chore: clarify invalid variation adjustment changelog
diff --git a/plugins/woocommerce/changelog/fix-zero-variation-sale-adjustment b/plugins/woocommerce/changelog/fix-zero-variation-sale-adjustment
new file mode 100644
index 00000000000..869ba40bd14
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-zero-variation-sale-adjustment
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Preserve variation sale prices when a bulk decrease from regular prices is empty or invalid.
diff --git a/plugins/woocommerce/client/legacy/js/admin/meta-boxes-product-variation.js b/plugins/woocommerce/client/legacy/js/admin/meta-boxes-product-variation.js
index c738b4625b0..5bcb43ae379 100644
--- a/plugins/woocommerce/client/legacy/js/admin/meta-boxes-product-variation.js
+++ b/plugins/woocommerce/client/legacy/js/admin/meta-boxes-product-variation.js
@@ -1303,7 +1303,16 @@ jQuery( function ( $ ) {
value = window.prompt( promptMessage );
if ( value != null ) {
- if ( value.indexOf( '%' ) >= 0 ) {
+ if (
+ do_variation_action ===
+ 'variable_sale_price_from_regular_price'
+ ) {
+ // Preserve invalid input for server-side validation instead of coercing it to zero.
+ data.value = value.trim().replace(
+ woocommerce_admin.mon_decimal_point,
+ '.'
+ );
+ } else if ( value.indexOf( '%' ) >= 0 ) {
data.value =
accounting.unformat(
value.replace( '%', '' ),
diff --git a/plugins/woocommerce/tests/php/includes/class-wc-ajax-test.php b/plugins/woocommerce/tests/php/includes/class-wc-ajax-test.php
index 8e01bf97b0d..c1e463f7b9b 100644
--- a/plugins/woocommerce/tests/php/includes/class-wc-ajax-test.php
+++ b/plugins/woocommerce/tests/php/includes/class-wc-ajax-test.php
@@ -1737,6 +1737,9 @@ class WC_AJAX_Test extends \WP_Ajax_UnitTestCase {
* ["45", "23.5%", "", "34.43"]
* ["5", "10", "", "0"]
* ["", "10%", "", ""]
+ * ["100", "0", "25", ""]
+ * ["100", "0%", "25", ""]
+ * ["100", "", "25", "25"]
* ["100", "invalid", "25", "25"]
* ["100", "-10", "25", "25"]
*