New currency not working


I followed your tutorial to add a new currency.
So I added the following code to my theme functions.php file:

add_filter( ‘gform_currencies’, ‘add_xpf_currency’ );
function add_xpf_currency( $currencies ) {
$currencies[‘XPF’] = array(
‘name’ => __( ‘CFP franc’, ‘gravityforms’ ),
‘symbol_left’ => ‘’,
‘symbol_right’ => ‘XPF’,
‘symbol_padding’ => ’ ',
‘thousand_separator’ => ’ ',
‘decimal_separator’ => ‘,’,
‘decimals’ => 0
return $currencies;

Unfortunately this new currency is not displayed in the currencies list in Gravity Forms settings page.

Did I miss something???

Looking at the code, it appears to be OK. I added it to my site and I have a new currency choice on the Forms > Settings page under Default Currency. It’s at the end of the dropdown (it’s not alphabetized):

Really lost here.
First I tried that the functions.php file from my theme was buggy… but then I installed a plugin to add custom code snippets and I got this message when I try to save the snippet:
Fatal error on line 3
syntax error, unexpected variable “$currencies”

I also tried with PHP 7.4 on the server, got this message:
syntax error, unexpected ‘$currencies’ (T_VARIABLE)

I think there is a problem with your code. Is there any other way to add a custom currency.

Hi Allan. We can help you with the code if you open a support ticket here:

Thank you.

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