From 6f9b8d0444b3a84f03d3f00e0951ebce194693b0 Mon Sep 17 00:00:00 2001 From: Saif Sultan Date: Fri, 10 Jan 2025 21:00:40 +0530 Subject: [PATCH] `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. --- .../gpecf-set-discount-amount-by-field-value.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 24fdb6dc5..b9a284634 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,7 +106,13 @@ public function output_script() { self.setDiscountAmount = function( value ) { // Clean the value to remove the thousand separator (could be , or . depending on currency settings). - value = gformCleanNumber( value, '', '', window.gf_global.gf_currency_config.decimal_separator ); + if ( gform.Currency && typeof gform.Currency.cleanNumber === 'function' ) { + // Gravity Forms 2.9 deprecates gformCleanNumber in favor of gform.Currency.cleanNumber. + value = gform.Currency.cleanNumber( value, '', '', window.gf_global.gf_currency_config.decimal_separator ).toString(); + } else { + // For Gravity Forms prior to 2.9. + value = gformCleanNumber( value, '', '', window.gf_global.gf_currency_config.decimal_separator ).toString(); + } if ( value.indexOf( '|' ) !== -1 ) { value = value.split( '|' )[0];