From 30377cf296df25b0d42fd39bce320e2162ab3a83 Mon Sep 17 00:00:00 2001 From: Saif Sultan Date: Fri, 22 Nov 2024 00:24:23 +0530 Subject: [PATCH 1/2] `gpecf-set-discount-amount-by-field-value.php`: Fixed an issue with comma values in discount calculations. --- .../gpecf-set-discount-amount-by-field-value.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gp-ecommerce-fields/gpecf-set-discount-amount-by-field-value.php b/gp-ecommerce-fields/gpecf-set-discount-amount-by-field-value.php index 8cc709162..55320b97a 100644 --- a/gp-ecommerce-fields/gpecf-set-discount-amount-by-field-value.php +++ b/gp-ecommerce-fields/gpecf-set-discount-amount-by-field-value.php @@ -105,6 +105,10 @@ public function output_script() { }; self.setDiscountAmount = function( value ) { + // Clean the value to remove the thousand separator (could be , or . depending on currency settings). + var thousandSeparator = window.gf_global.gf_currency_config.thousand_separator; + value = value.replace(new RegExp(thousandSeparator, 'g'), ''); + if ( value.indexOf( '|' ) !== -1 ) { value = value.split( '|' )[0]; } From b2b28cc8e7cb44d459e663212c06f6fb63ce718f Mon Sep 17 00:00:00 2001 From: Saif Sultan Date: Tue, 26 Nov 2024 15:34:13 +0530 Subject: [PATCH 2/2] `gpecf-set-discount-amount-by-field-value.php`: Fixed an issue with comma values in discount calculations. --- .../gpecf-set-discount-amount-by-field-value.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gp-ecommerce-fields/gpecf-set-discount-amount-by-field-value.php b/gp-ecommerce-fields/gpecf-set-discount-amount-by-field-value.php index 55320b97a..24fdb6dc5 100644 --- a/gp-ecommerce-fields/gpecf-set-discount-amount-by-field-value.php +++ b/gp-ecommerce-fields/gpecf-set-discount-amount-by-field-value.php @@ -106,8 +106,7 @@ public function output_script() { self.setDiscountAmount = function( value ) { // Clean the value to remove the thousand separator (could be , or . depending on currency settings). - var thousandSeparator = window.gf_global.gf_currency_config.thousand_separator; - value = value.replace(new RegExp(thousandSeparator, 'g'), ''); + value = gformCleanNumber( value, '', '', window.gf_global.gf_currency_config.decimal_separator ); if ( value.indexOf( '|' ) !== -1 ) { value = value.split( '|' )[0];