Sha256: cd4c75f68bb1c9806c2df220416b2b161cdf84795666176d0c5f808a5143772e

Contents?: true

Size: 580 Bytes

Versions: 19

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

19 entries across 19 versions & 1 rubygems

Version Path
spree_core-3.4.6 db/default/spree/countries.rb
spree_core-3.6.6 db/default/spree/countries.rb
spree_core-3.6.5 db/default/spree/countries.rb
spree_core-3.6.4 db/default/spree/countries.rb
spree_core-3.6.3 db/default/spree/countries.rb
spree_core-3.6.2 db/default/spree/countries.rb
spree_core-3.6.1 db/default/spree/countries.rb
spree_core-3.6.0 db/default/spree/countries.rb
spree_core-3.5.0 db/default/spree/countries.rb
spree_core-3.6.0.rc1 db/default/spree/countries.rb
spree_core-3.5.0.rc2 db/default/spree/countries.rb
spree_core-3.5.0.rc1 db/default/spree/countries.rb
spree_core-3.4.5 db/default/spree/countries.rb
spree_core-3.4.4 db/default/spree/countries.rb
spree_core-3.4.3 db/default/spree/countries.rb
spree_core-3.4.2 db/default/spree/countries.rb
spree_core-3.4.1 db/default/spree/countries.rb
spree_core-3.4.0 db/default/spree/countries.rb
spree_core-3.4.0.rc2 db/default/spree/countries.rb