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 display of available countries on checkout
Nathaniel Nande90df4f16e182
diff --git a/core/app/helpers/spree/base_helper.rb b/core/app/helpers/spree/base_helper.rbindex 780a6872d6..4cca35fe23 100644--- a/core/app/helpers/spree/base_helper.rb+++ b/core/app/helpers/spree/base_helper.rb@@ -3,11 +3,7 @@ module Spreedef available_countriescheckout_zone = current_store.checkout_zone || Spree::Zone.default_checkout_zone- countries = if checkout_zone && checkout_zone.kind == 'country'- checkout_zone.country_list- else- Spree::Country.all- end+ countries = checkout_zone ? checkout_zone.country_list : Spree::Country.allcountries.collect do |country|country.name = Spree.t(country.iso, scope: 'country_names', default: country.name)diff --git a/core/spec/helpers/base_helper_spec.rb b/core/spec/helpers/base_helper_spec.rbindex a0f04769f9..8a6171d399 100644--- a/core/spec/helpers/base_helper_spec.rb+++ b/core/spec/helpers/base_helper_spec.rb@@ -51,15 +51,17 @@ describe Spree::BaseHelper, type: :helper doendcontext 'checkout zone is of type state' do+ let(:state) { create(:state, country: country) }+before dostate_zone = create(:zone, name: 'StateZone')- state = create(:state, country: country)state_zone.members.create(zoneable: state)+Spree::Config[:checkout_zone] = state_zone.nameend- it 'return complete list of countries' do- expect(available_countries.count).to eq(Spree::Country.count)+ it 'returns list of countries associated with states' do+ expect(available_countries).to contain_exactly state.countryendendend