Single Blog

Irish Currency Format in Gravity Forms Fix

June 14, 2024, Written by 0 comment

Ireland is a bit of an outlier in the EU because unlike most other countries we use a decimal point rather than a comma to indicate cents. So in Ireland (like in the UK and USA) we say €10.50 but in Germany, France and the rest of the EU it’s €10,50. Unfortunately Gravity forms doesn’t make any distinction between countries in the EU and assumes we use a comma like out EU neighbours. That means a bit of a problem for WordPress sites using Gravity Forms in Ireland as if you are try to input the full amount including cents the decimal point is ignored.

If you make a donation of €10.00 on a Gravity Forms and write in the full amount including decimal points it becomes €1000… which can make for a very generous, but probably quite unhappy donor.

Probably something that should be addresses on the Gravity Forms end, but in the meantime here is fix:

 * Modify the decimal and thousand separators for the Euro currency in Gravity Forms.
 * This changes the decimal separator to a decimal point and the thousand separator to a comma.

add_filter('gform_currencies', 'modify_decimal_and_thousand_separator');
function modify_decimal_and_thousand_separator($currencies) {
    // Retrieve the existing EUR settings first to keep them intact
    $eur = $currencies['EUR'];
    // Modify the decimal and thousand separators
    $eur['decimal_separator'] = '.';
    $eur['thousand_separator'] = ',';

    // Assign back the modified settings to the EUR currency
    $currencies['EUR'] = $eur;
    return $currencies;

Andrew is a Wordpress enthusiast, web developer and founder of WP Care.