Skip to content

Commit 30377cf

Browse files
committed
gpecf-set-discount-amount-by-field-value.php: Fixed an issue with comma values in discount calculations.
1 parent 7d2ea71 commit 30377cf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

gp-ecommerce-fields/gpecf-set-discount-amount-by-field-value.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ public function output_script() {
105105
};
106106

107107
self.setDiscountAmount = function( value ) {
108+
// Clean the value to remove the thousand separator (could be , or . depending on currency settings).
109+
var thousandSeparator = window.gf_global.gf_currency_config.thousand_separator;
110+
value = value.replace(new RegExp(thousandSeparator, 'g'), '');
111+
108112
if ( value.indexOf( '|' ) !== -1 ) {
109113
value = value.split( '|' )[0];
110114
}

0 commit comments

Comments
 (0)