Gravity Forms is a powerful WordPress plugin for creating dynamic forms, and its ability to handle payments is one of its standout features. Out of the box, Gravity Forms supports a wide range of currencies, making it easy for users worldwide to process payments in their local currency.
In this article, we’ll explore the currencies supported by Gravity Forms and provide a guide to adding custom currencies with a code snippet.
List of Supported Currencies in Gravity Forms
Below is a list of the currently supported currencies by Gravity Forms:
$currencies = array(
'USD' => array(
'name' => 'U.S. Dollar',
'symbol_left' => '$',
'symbol_right' => '',
'symbol_padding' => '',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
'code' => 'USD',
),
'GBP' => array(
'name' => 'Pound Sterling',
'symbol_left' => '£',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
'code' => 'GBP',
),
'EUR' => array(
'name' => 'Euro',
'symbol_left' => '',
'symbol_right' => '€',
'symbol_padding' => ' ',
'thousand_separator' => '.',
'decimal_separator' => ',',
'decimals' => 2,
'code' => 'EUR',
),
'AUD' => array(
'name' => 'Australian Dollar',
'symbol_left' => '$',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
'code' => 'AUD',
),
'BRL' => array(
'name' => 'Brazilian Real',
'symbol_left' => 'R$',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => '.',
'decimal_separator' => ',',
'decimals' => 2,
'code' => 'BRL',
),
'CAD' => array(
'name' => 'Canadian Dollar',
'symbol_left' => '$',
'symbol_right' => 'CAD',
'symbol_padding' => ' ',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
'code' => 'CAD',
),
'CZK' => array(
'name' => 'Czech Koruna',
'symbol_left' => '',
'symbol_right' => 'Kč',
'symbol_padding' => ' ',
'thousand_separator' => ' ',
'decimal_separator' => ',',
'decimals' => 2,
'code' => 'CZK',
),
'DKK' => array(
'name' => 'Danish Krone',
'symbol_left' => '',
'symbol_right' => 'kr.',
'symbol_padding' => ' ',
'thousand_separator' => '.',
'decimal_separator' => ',',
'decimals' => 2,
'code' => 'DKK',
),
'HKD' => array(
'name' => 'Hong Kong Dollar',
'symbol_left' => 'HK$',
'symbol_right' => '',
'symbol_padding' => '',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
'code' => 'HKD',
),
'HUF' => array(
'name' => 'Hungarian Forint',
'symbol_left' => '',
'symbol_right' => 'Ft',
'symbol_padding' => ' ',
'thousand_separator' => '.',
'decimal_separator' => ',',
'decimals' => 2,
'code' => 'HUF',
),
'ILS' => array(
'name' => 'Israeli New Sheqel',
'symbol_left' => '₪',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
'code' => 'ILS',
),
'JPY' => array(
'name' => 'Japanese Yen',
'symbol_left' => '¥',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => ',',
'decimal_separator' => '',
'decimals' => 0,
'code' => 'JPY',
),
'MYR' => array(
'name' => 'Malaysian Ringgit',
'symbol_left' => 'RM',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
'code' => 'MYR',
),
'MXN' => array(
'name' => 'Mexican Peso',
'symbol_left' => '$',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
'code' => 'MXN',
),
'NOK' => array(
'name' => 'Norwegian Krone',
'symbol_left' => 'Kr',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => '.',
'decimal_separator' => ',',
'decimals' => 2,
'code' => 'NOK',
),
'NZD' => array(
'name' => 'New Zealand Dollar',
'symbol_left' => '$',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
'code' => 'NZD',
),
'PHP' => array(
'name' => 'Philippine Peso',
'symbol_left' => 'Php',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
'code' => 'PHP', // bun not intended.
),
'PLN' => array(
'name' => 'Polish Zloty',
'symbol_left' => 'zł',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => '.',
'decimal_separator' => ',',
'decimals' => 2,
'code' => 'PLN',
),
'RUB' => array(
'name' => 'Russian Ruble',
'symbol_left' => '',
'symbol_right' => 'pyб',
'symbol_padding' => ' ',
'thousand_separator' => ' ',
'decimal_separator' => '.',
'decimals' => 2,
'code' => 'RUB',
),
'SGD' => array(
'name' => 'Singapore Dollar',
'symbol_left' => '$',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
'code' => 'SGD',
),
'ZAR' => array(
'name' => 'South African Rand',
'symbol_left' => 'R',
'symbol_right' => '',
'symbol_padding' => '',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
'code' => 'ZAR',
),
'SEK' => array(
'name' => 'Swedish Krona',
'symbol_left' => '',
'symbol_right' => 'Kr',
'symbol_padding' => ' ',
'thousand_separator' => ' ',
'decimal_separator' => ',',
'decimals' => 2,
'code' => 'SEK',
),
'CHF' => array(
'name' => 'Swiss Franc',
'symbol_left' => 'CHF',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => "'",
'decimal_separator' => '.',
'decimals' => 2,
'symbol_old' => 'Fr.',
'code' => 'CHF',
),
'TWD' => array(
'name' => 'Taiwan New Dollar',
'symbol_left' => '$',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
'code' => 'TWD',
),
'THB' => array(
'name' => 'Thai Baht',
'symbol_left' => '฿',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
'code' => 'THB',
),
);
Adding a Custom Currency to Gravity Forms
If you need to use a currency that isn’t included in the default list, you can add it using a custom code snippet. For example, let’s add the Bitcoin (BTC) currency. You can refer to this snippet to add any other currency to Gravity Forms.
Steps to Add a Custom Currency
- Edit your child theme’s functions.php file
Navigate to your WordPress admin panel, go to Appearance > Theme Editor, and open thefunctions.php
. Or use an FTP client like FileZilla to edit the functions.php of your child theme. - Insert the Code Snippet
Add the following code snippet to the file:
add_filter('gform_currencies', 'add_custom_currency');
function add_custom_currency($currencies) {
$currencies['BTC'] = array(
'name' => __('Bitcoin', 'gravityforms'),
'symbol_left' => '₿',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 8, // Bitcoin commonly uses 8 decimal places
);
return $currencies;
}
- Save and Test
Save your changes and test the new currency. In the currency settings, you should now see Bitcoin (BTC) as an option.
Custom Currency Parameters
Here’s a breakdown of the parameters in the code snippet:
name
: The display name of the currency.symbol_left
: The currency symbol displayed to the left of the amount.symbol_right
: The currency symbol displayed to the right of the amount.symbol_padding
: The spacing between the amount and the symbol.thousand_separator
: The character used to separate thousands.decimal_separator
: The character used to denote decimals.decimals
: The number of decimal places to display.
How to Delete a Currency in Gravity Forms
There might be situations where you want to remove a specific currency from the list of available options in Gravity Forms. For instance, you may wish to restrict the currencies displayed to align with your business’s payment policies or simplify the selection process for users.
Here’s how you can delete a currency in Gravity Forms using a simple code snippet:
Steps to Remove a Currency
- Edit your child theme’s functions.php file
Navigate to your WordPress admin panel, go to Appearance > Theme Editor, and open thefunctions.php
file of your active theme. - Insert the Code Snippet
Add the following code snippet to remove a specific currency (e.g., Bitcoin – BTC):
add_filter('gform_currencies', 'remove_currency');
function remove_currency($currencies) {
// Replace 'BTC' with the currency code you want to remove
unset($currencies['BTC']);
return $currencies;
}
- Save and Test
Save the changes, refresh your WordPress admin panel, and check the Gravity Forms currency settings. The currency you removed (in this case, Bitcoin – BTC) will no longer appear as an option.
Tip: Multi-Currency Support
If you often deal with multiple currencies, consider using plugins like Multi-Currency for Gravity Forms (one of our offerings at IdeaWP). It allows dynamic currency selection and simplifies managing payments across borders.
Key Features of Multi-Currency for Gravity Forms are:
- Dynamic Currency Switching
Automatically switch currencies based on the user’s geolocation or preferences, providing a localized and user-friendly experience. - Currency Conversion
Seamlessly convert prices to the user’s preferred currency using real-time exchange rates, ensuring accuracy in every transaction. - Custom Exchange Rates
Override live rates with custom exchange rates to account for fees, discounts, or fixed pricing strategies. - Multi-Currency Payment Gateways
Ensure compatibility with popular payment gateways like PayPal, Stripe, Authroize.net, Mollie and more, allowing transactions in the user’s selected currency.
Leave a Reply