Remove currency symbol from the product field

Hi

I want to remove Euro currency symbol from the product field, ginput_amount field.

I have tried adding this code to my functions.php file but the plugin seems to overwrite the settings and place a currency on the right side of the amount which I do not want to display.

Here is my code

add_filter( 'gform_currencies', function( $currencies ) {
$currencies['EUR']['symbol_left'] = '';
     $currencies['EUR']['symbol_right'] = '';
     return $currencies;
} );

Hi Prakhar,

This code seems to work when I test it. Here’s a screenshot of a form preview after adding the code.

Hi @prakhar
To remove the currency symbol from the product field in Gravity Forms, you can try using the gform_currency_symbol filter hook. This hook allows you to modify the currency symbol displayed in a form.

Here’s an example of how you can use this hook to remove the Euro currency symbol from the product field:

add_filter( 'gform_currency_symbol', 'remove_euro_symbol', 10, 2 );
function remove_euro_symbol( $currency_symbol, $currency ) {
    if ( $currency == 'EUR' ) {
        $currency_symbol = '';
    }
    return $currency_symbol;
}

This code will remove the currency symbol from all Euro fields in the form. If you only want to remove the currency symbol from a specific field, you can use the gform_field_value filter hook to target that particular field.

Here’s an example of how you can use this hook to remove the Euro currency symbol from the ginput_amount field:

add_filter( 'gform_field_value', 'remove_euro_symbol_from_field', 10, 3 );
function remove_euro_symbol_from_field( $value, $field, $name ) {
    if ( $name == 'ginput_amount' && $field['currency'] == 'EUR' ) {
        $value = str_replace( '€', '', $value );
    }
    return $value;
}

I hope this helps! Let me know if you have any other questions.

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