spree/spree — pull request #2197 by gmacdougall (2012-11-09 00:35:49+00:00)
Title: Multi-Currency Price support

This allows variants to be offered at different currencies on the same
store through all steps of the spree checkout prices.

A quick guide to what you can currently do:

* Start up a new sandbox
* Switch currency in admin area from USD to Euro (or vice-versa)

Products are shown in either USD or Euro, and you can follow the purchase process through to complete the order phase.

Future orders and line items are save the currency as they are created, but old line items and currency will have a nil currency. In cases of nil currency, the currency value will be the globally configured Spree::Config[:currency]. You can note that as you change the currency back and forth, the sandbox loaded orders will switch their currency symbol (mirroring current spree master functionality), but orders made using this codebase will reflect the currency they were made in. It may make sense to populate the currency as part of a migration in order to correctly reflect the state of everything.

All line items in a single order must be from the same currency. Since an order is currency specific, if you change the global currency setting while an in progress order has items in their cart, a new (empty) cart will be created for them on their next page view.

A variant must have a price in the globally configured currency in order to be displayed in the store. For example, if you change the global currency to AUD, and attempt to browse items, no products will be displayed (unless those items have an AUD price)

Things I still plan to do:

* Provide a way to list supported currencies for our store. For example, my store supports EUR and USD, but not the other 100+ currencies.
* Add a way for users to select which currency they wish to browse items in from the list of supported currencies. Currently, the global currency selector is still the only way to change which currency items are browsable in.
* Provide an administration interface to set the prices in the various currencies. Currently, this can only be done through the rails console, or by changing the global admin currency.
* Add currency support to variant cost_price.

I'm looking for feedback at this stage. It is a somewhat invasive change to make to Spree, so please let me know if there's anything that you'd like to see improved.