How do I move the currency symbol from the right to the left for Gravity Forms?
A simple snippet to move currency symbol from the left to the right of the currency amount.
April 11th, 2023: Simplified snippet to be more future-proof.
October 2nd, 2015: Fixed typo. Parenthesis replaced with curly brace.
Getting Started
Install the snippet
- Copy and paste the entire snippet into your theme’s functions.php file or install via a code snippet management plugin like Code Snippets.
Configure the snippet
- This snippet moves the Euro’s currency symbol to the left by moving the symbol’s HTML entity from the “symbol_right” property to the “symbol_left” property.
- If you’d like to apply this to a different currency you will need to change the
'EUR'
on lines 7 and 8 to the appropriate abbreviation for your desired currency. See the tip below for an easy way to find out the correct abbreviation.
For a list of default Gravity Forms currencies and an overview of the available currency parameters, check out the Gravity Forms Currencies resource.
Any questions?
What else do you need to do with Gravity Forms currencies? Let us know in the comments!
I believe you should update the last line now like this, otherwise it stopped working:
add_filter( ‘gform_currencies’, function( $currencies ) { $currencies[‘EUR’] = array( ‘name’ => esc_html__( ‘Euro’, ‘gravityforms’ ), ‘symbol_left’ => ‘€’, ‘symbol_right’ => ”, ‘symbol_padding’ => ‘ ‘, ‘thousand_separator’ => ‘.’, ‘decimal_separator’ => ‘,’, ‘decimals’ => 2, ‘code’ => ‘EUR’ ); return $currencies; } );
Hi Vitaljik,
Thanks for pointing this out! The snippet has been updated.
Hi,
WPML checks the language with ICL_LANGUAGE_CODE:
if (ICL_LANGUAGE_CODE == ‘en’)
So I need to have the code to check if the language is EN, then
‘symbol_left’ => ‘€’, ‘symbol_right’ => ”, ‘symbol_padding’ => ‘ ‘, ‘thousand_separator’ => ‘,’, ‘decimal_separator’ => ‘.’, ‘decimals’ => 2
ELSE (with our other languages)
‘symbol_left’ => ”, ‘symbol_right’ => ‘€’, ‘symbol_padding’ => ‘ ‘, ‘thousand_separator’ => ‘.’, ‘decimal_separator’ => ‘,’, ‘decimals’ => 2
What would be the correct code for this language check? I almost got it right, but not totally working or giving errors.
Also, I noticed that if I change the settings above my product option price changes in the form from €0.20 (EN is the default language) to 20,00€. That is strange?
Thanks in advance.
Hi Harriet,
This is not currently supported and it will probably need a little tweak of the snippet. If you have an active Gravity Perks license, can you get in touch with us via our support form? About the currency symbol being moved and changing the price I’ll suggest you get in touch with Gravity Forms support team on this.
Best,
Hi,
this is great. But how about changing the currency sign placement and separator according to the site language (WPML)?
We have 3 languages: the default is EN (en_US) and the others are Finnish FI (FI) and Swedish SV (sv_SE).
We use the language code in the url, like default.com, default.com/fi, default.com/sv
In Finnish and Swedish the price should be 25,50€ and in English €25.50
Thanks in advance.
Hi Linda,
This is not currently supported and it will probably need a little tweak of the snippet. You could contact WPML to see if there’s a way to check which lang is rendering and add an IF/ELSE condition to the snippet so it applies differently to each language.
I hope this helps.
Well, it was a life saving. Until I realized I changed all price fields. I’m trying to include “+ shipping” in total price; but I want to hold the XX,XX € in the rest of prices showed in my form.
Any way to point this snippet to a specific field in a specific form??? Thanks for your cooperation, love perks!
Hi Nahuel,
Unfortunately no. The Gravity Forms currency setting is sitewide and affects every form and field.
Best,
Thank you for this!
Thanks! Still working
Hi Do you know how to hide the currency symbol all together when using a product field,
The problem we have is we sell in £$€ and hard code this to emails notifications, and just need to remove the currency symbol all together
Hi Mart, try removing the value for “symbol_right” and “symbol_left”.
I tip my hat again Sir, FYI Euro standard is a . as a currency separator and , as a thousand. The code above has them flipped. Below is the format for a Euro total field like (€ 0.99 or € 1,000.99)
Hi Niall, I’m no expert on this subject, but my understanding is that you can format the Euro either way depending on your country. Most European countries appear to use the dot for thousands and the comma for decimals.
Also, this snippet doesn’t actually change the decimal or thousands separators from that which is included in core by default for the Euro.
Definitely open to new information on this subject. :)
I was just browsing all the goodies on the site and stumbled upon this one, works like magic. Real easy! Just wanted to thank you!
Glad you’re digging the site, Richard. Make sure you check out Gravity Perks too. :)
There’s a typo in the last line – should be no ), but a closing }.
Thanks, Bob! Fixed.