Gravity Wiz

Magically enhanced tutorials, snippets and plugins for Gravity Forms!

  • Gravity Perks
    • Gravity Perks
    • Tutorials & Snippets
    • About
  • Support
    • Documentation
    • Support
    • Account

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.

Last updated October 2, 2015 | Written by David Smith 6 Comments

  • October 2nd, 2015: Fixed typo. Parenthesis replaced with curly brace.

Download Code
<?php
/**
* Graivty Wiz // Gravity Forms // Move Currency Symbol from the Right to the Left (i.e. "0,00 €" to "€ 0,00")
* https://gravitywiz.com/how-do-i-move-the-currency-symbol-from-the-right-to-the-left-for-gravity-forms/
*/
add_filter( 'gform_currencies', 'gw_modify_currencies' );
function gw_modify_currencies( $currencies ) {
$currencies['EUR'] = array(
'name' => esc_html__( 'Euro', 'gravityforms' ),
'symbol_left' => '&#8364;',
'symbol_right' => '',
'symbol_padding' => ' ',
'thousand_separator' => '.',
'decimal_separator' => ',',
'decimals' => 2
);
return $currencies;
}
view raw gw-gravity-forms-currency-symbol-right-to-left.php hosted with ❤ by GitHub

Getting Started

  1. 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.
  2. 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 line 9 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!

Did this resource help you do something awesome with Gravity Forms? Then you'll absolutely love Gravity Perks; a suite of 29+ essential add-ons for Gravity Forms with support you can count on.

  • View All Perks
  • Buy Gravity Perks

Filed Under: How To currency

Comments

  1. Niall Flynn says

    March 3, 2017 at 5:40 am

    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)

    Reply
    • David Smith says

      March 3, 2017 at 8:18 am

      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. :)

  2. Richard says

    April 11, 2016 at 2:50 pm

    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!

    Reply
    • David Smith says

      April 11, 2016 at 8:13 pm

      Glad you’re digging the site, Richard. Make sure you check out Gravity Perks too. :)

  3. Bob says

    October 2, 2015 at 10:15 pm

    There’s a typo in the last line – should be no ), but a closing }.

    Reply
    • David Smith says

      October 2, 2015 at 11:55 pm

      Thanks, Bob! Fixed.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories

  • How To (29)
  • News (20)
  • Plugins (5)
  • Releases (5)
  • Resource (1)
  • Snippets (61)
  • Tip (1)
  • Tutorials (43)
  • Updates (62)

Recent Posts

  • Gravity Wiz Weekly #62
  • Gravity Forms Populate Anything, Public Beta Available!
  • Gravity Wiz Weekly #61
  • Gravity Wiz Weekly #60
  • Gravity Wiz Weekly #59

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Copyright © 2019 · Powered by WordPress · Gravity Wiz LLC · Log out

  • Support
  • Affiliates
  • About
  • Sitemap
  • Gravity Perks
    ▼
    • Gravity Perks
    • Tutorials & Snippets
    • About
  • Support
    ▼
    • Documentation
    • Support
    • Account