Skip to content

Latest commit

 

History

History
44 lines (34 loc) · 1.4 KB

multi-currency-support.md

File metadata and controls

44 lines (34 loc) · 1.4 KB

Multi-currency support

Spree::Price objects track a price for a specific currency and variant combination. For example, if a variant is available for $15 USD or €7 EUR, that variant would have two Spree::Price objects associated with it (one for each currency).

If none of a product's Spree::Variants have a price value for the site's configured currency, that product is not visible in the store frontend.

You can see a variant's price in the store's configured currency by calling the price method on that instance:

Spree::Variant.find(1).price
# => 15.99

You can also call the price method on a Spree::Product. If you call the price method on a product, it gets the price of the product's master variant.

For a list of all of the Spree::Prices associated with a product or variant, you can call the prices method on an instance of them:

Spree::Product.find(1).prices
# => [#<Spree::Price id: 2 ...]
#    [#<Spree::Price id: 3 ...]

Spree::Variant.find(1).prices
# => [#<Spree::Price id: 4 ...]
#    [#<Spree::Price id: 5 ...]