How to Create a New Currency Symbol for WPForms

Overview

Would you like to create a new currency symbol for your WPForms? WPForms already has many currencies to choose from, however, if you would like to add a new symbol or simply just move the position of an already existing currency symbol, this is easily achievable. This tutorial will walk you through the steps of adding a new currency to your WPForms.

Setup

The code below will add Lira currency as an option under WPForms » Settings » Payments tab. Just add the code snippet below to your site.

/**
 * Add a new currency symbol
 * 
 * @link https://wpforms.com/developers/how-to-create-a-new-currency-symbol-for-wpforms/
 *
 */
function wpf_dev_currencies( $currencies ) {

    $currencies['LRA'] = array(
        'name'                => esc_html__( 'Lira', 'wpforms' ),
        'symbol'              => '₤',
        'symbol_pos'          => 'right', // enter left or right to position the symbol
        'thousands_separator' => ',',
        'decimal_separator'   => '.',
        'decimals'            => 2,
    );
  return $currencies;
}
add_filter( 'wpforms_currencies', 'wpf_dev_currencies' );

You've now used PHP to create a new currency symbol

And that’s it! You’ve now added a new currency to your WPForms. Would you like to know how to change the position of the description? Take a look at our tutorial on How to Position the Field Description Above the Form Field.

Filter Reference: wpforms_currencies

FAQ

Q: How can I move the currency symbol?

A: In this example, we’ll move the U.S. Dollar (USD) symbol from the left to the right using the following snippet.

function wpf_dev_currencies( $currencies ) {

    $currencies['USD'] = array(
        'name'                => esc_html__( 'U.S. Dollar', 'wpforms' ),
        'symbol'              => '$',
        'symbol_pos'          => 'right', // left or right
        'thousands_separator' => ',',
        'decimal_separator'   => '.',
        'decimals'            => 2,
    );
  return $currencies;
}
add_filter( 'wpforms_currencies', 'wpf_dev_currencies' );

Now the symbol has been moved from showing on the left to showing on the right.