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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Fixed store default country issue
Nathaniel Nande23f17bfe01c1
diff --git a/backend/app/views/spree/admin/stores/_form.html.erb b/backend/app/views/spree/admin/stores/_form.html.erbindex 1321f1398b..56421f0676 100644--- a/backend/app/views/spree/admin/stores/_form.html.erb+++ b/backend/app/views/spree/admin/stores/_form.html.erb@@ -122,8 +122,8 @@<%= f.error_message_on :default_locale %><% end %><%= f.field_container :default_country_id, class: ['form-group'] do %>- <%= f.label :default_country_id, Spree.t('i18n.country') %>- <%= f.select :default_country_id, options_from_collection_for_select(@countries, :id, :name, @store.default_country_id), {}, { class: 'select2' } %>+ <%= f.label :default_country_id, Spree.t('i18n.default_country') %>+ <%= f.select :default_country_id, options_from_collection_for_select(@countries, :id, :name, @store.default_country_id || Spree::Config[:default_country_id]), {}, { class: 'select2' } %><%= f.error_message_on :default_country_id %><% end %></div>diff --git a/core/config/locales/en.yml b/core/config/locales/en.ymlindex 608fbac486..6a5d3645af 100644--- a/core/config/locales/en.yml+++ b/core/config/locales/en.yml@@ -950,6 +950,7 @@ en:fields: Fieldslanguage: Languagecountry: Country+ default_country: Default Countrylocalization_settings: Localization Settingsonly_incomplete: Only incompleteonly_complete: Only completediff --git a/core/db/default/spree/stores.rb b/core/db/default/spree/stores.rbindex 15eb7ad152..4c2d29d1ff 100644--- a/core/db/default/spree/stores.rb+++ b/core/db/default/spree/stores.rb@@ -1,16 +1,20 @@-# Possibly already created by a migration.-unless Spree::Store.default.persisted?+default_store = Spree::Store.default++if default_store.persisted?+ default_store.update!(default_country_id: Spree::Config[:default_country_id])+elseSpree::Store.new do |s|- s.name = 'Spree Demo Site'- s.code = 'spree'- s.url = Rails.application.routes.default_url_options[:host] || 'demo.spreecommerce.org'- s.mail_from_address = '[email protected]'- s.customer_support_email = '[email protected]'- s.default_currency = 'USD'- s.seo_title = 'Spree Commerce Demo Shop'- s.meta_description = 'This is the new Spree UX DEMO | OVERVIEW: http://bit.ly/new-spree-ux | DOCS: http://bit.ly/spree-ux-customization-docs | CONTACT: https://spreecommerce.org/contact/'- s.facebook = 'spreecommerce'- s.twitter = 'spreecommerce'- s.instagram = 'spreecommerce'+ s.name = 'Spree Demo Site'+ s.code = 'spree'+ s.url = Rails.application.routes.default_url_options[:host] || 'demo.spreecommerce.org'+ s.mail_from_address = '[email protected]'+ s.customer_support_email = '[email protected]'+ s.default_currency = 'USD'+ s.default_country_id = Spree::Config[:default_country_id]+ s.seo_title = 'Spree Commerce Demo Shop'+ s.meta_description = 'This is the new Spree UX DEMO | OVERVIEW: http://bit.ly/new-spree-ux | DOCS: http://bit.ly/spree-ux-customization-docs | CONTACT: https://spreecommerce.org/contact/'+ s.facebook = 'spreecommerce'+ s.twitter = 'spreecommerce'+ s.instagram = 'spreecommerce'end.save!end