Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Create prices in all currencies to support new Stores

Damian Legawiecbca32817a380
diff --git a/sample/db/samples/stores.rb b/sample/db/samples/stores.rb
index e1ad851c9f..cd6dac705b 100644
--- a/sample/db/samples/stores.rb
+++ b/sample/db/samples/stores.rb
@@ -23,4 +23,13 @@ uk_store.checkout_zone = Spree::Zone.find_by(name: 'UK_VAT')
uk_store.default_country = Spree::Country.find_by(iso: 'GB')
uk_store.save!
+currencies = %w[EUR GBP]
+Spree::Price.where(currency: 'USD').each do |price|
+ currencies.each do |currency|
+ new_price = Spree::Price.find_or_initialize_by(currency: currency, variant: price.variant)
+ new_price.amount = price.amount
+ new_price.save
+ end
+end
+
Spree::Config[:show_store_selector] = true