User defined price field - 12.50 euro transfers into 1.250 euro - How do I prevent this?

The user defined price field. If I enter for example 12.50 euro and go on to the next input field it transfers into 1.250 euro. So if people don’t watch out they will pay 1.250 euros instead of 12,50 euros.

How do I prevent this from happening?

Screenshot 2023-11-02 at 11.15.50

I tried this filter, but it doesn’t work:

add_filter( 'gform_include_thousands_sep_pre_format_number', '__return_false' );

You’ll need to use the gform_currencies filter to swap the decimal and thousands separators for the Euro currency.

Yeah I also tried that with this code:

add_filter( 'gform_currencies', function( $currencies ) {
    GFCommon::log_debug( 'gform_currencies: running.' );
    $currencies['EUR']['thousand_separator'] = '.';
    $currencies['EUR']['decimal_separator'] = ',';
    $currencies['EUR']['decimals'] = 2;
    return $currencies;
} );

But that unfortunatly doesn’t solve the problem

That’s the default config for Euro, you’ll need to swap them e.g.

$currencies['EUR']['thousand_separator'] = ',';
$currencies['EUR']['decimal_separator'] = '.';

I understand your solution, but that is not what I want to achieve. Because people still need to be able to enter 12,50 to pay 12,50. The problem is, if somebody accidentally uses a dot instead of a comma then they will not pay 12,50 but 1.250.

Gravity Forms just doesn’t support using both formats at the same time. You could add an example amount in the field description showing the format they should use when entering their value.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.