How to change spree currency?
Asked Answered
N

4

5

I have trouble with spree, and dont know how to deal with it. I can't change the main currency.

How can I do it?

Navicular answered 16/5, 2011 at 21:38 Comment(0)
B
8

It's easier in Spree 2.0.0 and obviously it will work in previous versions of spree too.

Go to your config/initializers/spree.rb and in Spree.config block write the following code.

Spree.config do |config|

  config.currency = 'EUR'

end
Bravado answered 3/7, 2013 at 11:58 Comment(0)
R
5

If you just want to show some other currency sign in Spree than $ you have to change that in Rails locale file in your Spree project. Example for Estonian locale and Euro is on the below.

config/locales/et_rails.yml:

et:
  number:
    # Used in number_to_currency()
    currency:
      format:
        # Where is the currency sign? %u is the currency unit, %n the number (default: $5.00)
        format: "%n %u"
        unit: "€"
        # These three are to override number.format and are optional
        separator: "."
        delimiter: " "
        precision: 2

Maybe other alternative is to use Multi Currency plugin: http://spreecommerce.com/extensions/94-spree-multi-currency

Regardless answered 22/5, 2011 at 15:0 Comment(0)
W
3

For spree 1.3.x, we have to set the :currency preference.

Eg. config/initializers/spree.rb

Spree.config do |config|
  ...
  config.currency = 'EUR'
end
Worldling answered 27/4, 2013 at 13:36 Comment(0)
A
1

I tried in spree 0.11 with rails 2. To change currency or change other localization following things needs to be done.

  1. Copy en_spree.yml file from spree/config/locales/ folder to /config/locales/ folder. (this file can be with some different name also depends on default locale).
  2. Save this file with en.yml also in /config/locales/ folder. Its a replication.
  3. Do modification for any string or currency. For currency follow above answer of Priidik Vaikla.
  4. modify spree.rb in your /config/initializers/ folder by adding this line:

    Spree::Config.set(:default_locale => 'en')

Note: you can change default en with other language but .yml file names should change accordingly.

Restart your server and check the output.

Antiseptic answered 7/4, 2012 at 6:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.