bookmark_bordergform_currencies

Description

This filter can be used to update existing currencies and/or create new currencies.

Usage

add_filter( 'gform_currencies', 'update_currency' );

Parameters

  • $currencies array

    An array of all existing currencies.

Examples

1. Euro

This example demonstrates how to update an existing currency.

add_filter( 'gform_currencies', 'update_currency' );
function update_currency( $currencies ) {
    $currencies['EUR'] = array(
        'name'               => __( 'Euro', 'gravityforms' ),
        'symbol_left'        => '€',
        'symbol_right'       => '',
        'symbol_padding'     => ' ',
        'thousand_separator' => ',',
        'decimal_separator'  => '.',
        'decimals'           => 2
    );

    return $currencies;
}

2. Indian Rupee

add_filter( 'gform_currencies', 'add_inr_currency' );
function add_inr_currency( $currencies ) {
    $currencies['INR'] = array(
        'name'               => __( 'India Rupee', 'gravityforms' ),
        'symbol_left'        => '₹',
        'symbol_right'       => '',
        'symbol_padding'     => ' ',
        'thousand_separator' => ',',
        'decimal_separator'  => '.',
        'decimals'           => 2
    );

    return $currencies;
}

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

This filter is located in RGCurrency::get_currencies() in currency.php