Sha256: d206a279da67d90415be261bda2c2b6d715b2fe4cc3d11305db2a43ab62a0dcc

Contents?: true

Size: 580 Bytes

Versions: 55

Compression:

Stored size: 580 Bytes

Contents

require 'carmen'

Carmen::Country.all.each do |country|
  Spree::Country.where(
    name: country.name,
    iso3: country.alpha_3_code,
    iso: country.alpha_2_code,
    iso_name: country.name.upcase,
    numcode: country.numeric_code,
    states_required: country.subregions?
  ).first_or_create
end

Spree::Config[:default_country_id] = Spree::Country.find_by(iso: 'US').id

# find countries that do not use postal codes (by iso) and set 'zipcode_required' to false for them.

Spree::Country.where(iso: Spree::Address::NO_ZIPCODE_ISO_CODES).update_all(zipcode_required: false)

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
spree_core-4.0.9 db/default/spree/countries.rb
spree_core-4.1.15 db/default/spree/countries.rb
spree_core-4.1.14 db/default/spree/countries.rb
spree_core-4.0.8 db/default/spree/countries.rb
spree_core-3.7.14.1 db/default/spree/countries.rb
spree_core-4.1.13.1 db/default/spree/countries.rb
spree_core-4.0.7.1 db/default/spree/countries.rb
spree_core-4.0.7 db/default/spree/countries.rb
spree_core-3.7.14 db/default/spree/countries.rb
spree_core-4.1.13 db/default/spree/countries.rb
spree_core-4.0.6 db/default/spree/countries.rb
spree_core-3.7.13 db/default/spree/countries.rb
spree_core-4.0.5 db/default/spree/countries.rb
spree_core-4.1.12 db/default/spree/countries.rb
spree_core-3.7.12 db/default/spree/countries.rb
spree_core-4.0.4 db/default/spree/countries.rb
spree_core-3.7.11 db/default/spree/countries.rb
spree_core-4.1.11 db/default/spree/countries.rb
spree_core-4.1.10 db/default/spree/countries.rb
spree_core-4.2.0.beta db/default/spree/countries.rb