Skip to content

Commit 6f9b8d0

Browse files
committed
gpecf-set-discount-amount-by-field-value.php: Fixed an issue with snippet not working.
`gpecf-set-discount-amount-by-field-value.php`: Fixed an issue with snippet not working. `gpecf-set-discount-amount-by-field-value.php`: Fixed an issue with snippet not working. `gpecf-set-discount-amount-by-field-value.php`: Fixed an issue with snippet not working.
1 parent 1106636 commit 6f9b8d0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,13 @@ public function output_script() {
106106

107107
self.setDiscountAmount = function( value ) {
108108
// Clean the value to remove the thousand separator (could be , or . depending on currency settings).
109-
value = gformCleanNumber( value, '', '', window.gf_global.gf_currency_config.decimal_separator );
109+
if ( gform.Currency && typeof gform.Currency.cleanNumber === 'function' ) {
110+
// Gravity Forms 2.9 deprecates gformCleanNumber in favor of gform.Currency.cleanNumber.
111+
value = gform.Currency.cleanNumber( value, '', '', window.gf_global.gf_currency_config.decimal_separator ).toString();
112+
} else {
113+
// For Gravity Forms prior to 2.9.
114+
value = gformCleanNumber( value, '', '', window.gf_global.gf_currency_config.decimal_separator ).toString();
115+
}
110116

111117
if ( value.indexOf( '|' ) !== -1 ) {
112118
value = value.split( '|' )[0];

0 commit comments

Comments
 (0)