If you’re using Gravity Forms for your WordPress website and need to include the Nigeria Naira (₦) as a currency option, you’ll find that it’s not available by default. However, you can easily add it with a bit of custom code. Here’s how:
- Add the following code to your theme’s
functions.php
file or a site-specific plugin:
<?php
/**
* Adds the Nigerian Naira currency to Gravity Forms.
*
* @param array $currencies The current currencies registered in Gravity Forms.
*
* @return array List of supported currencies.
*/
function gf_add_ngn_support( $currencies ) {
// Check if the currency is already registered.
if ( ! array_key_exists( 'NGN', $currencies ) ) {
// Add NGN to the list of supported currencies.
$currencies['NGN'] = array(
'name' => 'Nigerian Naira',
'symbol_left' => '₦',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => ',',
'decimal_separator' => '.',
'decimals' => 2,
'code' => 'NGN',
);
}
return $currencies;
}
// Run the filter to add the currency.
add_filter( 'gform_currencies', 'gf_add_ngn_support' );
- Save the file and refresh your WordPress admin area.
- Go to Forms > Settings > Currency in your WordPress dashboard.
- You should now see “Nigeria Naira” as an option in the dropdown menu.
- Select it and save your changes.
That’s it! You can now use the Nigeria Naira currency in your Gravity Forms.
Remember to test your forms to ensure the new currency is displaying correctly. If you encounter any issues, double-check the code or consult with a developer familiar with WordPress and Gravity Forms.