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.

Fix markets:migrate_checkout_zones failing with validation error (#13892)

Agnieszka Jacekc0a419299c37
diff --git a/spree/core/lib/tasks/markets.rake b/spree/core/lib/tasks/markets.rake
index 2300662137..27e2388b3f 100644
--- a/spree/core/lib/tasks/markets.rake
+++ b/spree/core/lib/tasks/markets.rake
@@ -27,13 +27,10 @@ namespace :spree do
name: primary_country&.name || 'Default',
currency: iso_country&.currency_code || store.read_attribute(:default_currency) || 'USD',
default_locale: iso_country&.languages_official&.first || store.read_attribute(:default_locale) || 'en',
- default: true
+ default: true,
+ country_ids: countries.map(&:id)
)
- countries.each do |country|
- market.market_countries.build(country: country).save!(validate: false)
- end
-
store.update_column(:checkout_zone_id, nil) if checkout_zone_id
puts " Created market '#{market.name}' with #{countries.size} countries for store '#{store.name}' (#{store.code})"