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
Use zone from Store checkout_zone_id attr
Przemek Kosakowskibc09f75cf493
diff --git a/core/app/helpers/spree/base_helper.rb b/core/app/helpers/spree/base_helper.rbindex 181f99e234..e8adb2ffed 100644--- a/core/app/helpers/spree/base_helper.rb+++ b/core/app/helpers/spree/base_helper.rb@@ -1,7 +1,7 @@module Spreemodule BaseHelperdef available_countries- checkout_zone = Spree::Zone.find_by(name: Spree::Config[:checkout_zone])+ checkout_zone = current_store.zone || Spree::Zone.find_by(name: Spree::Config[:checkout_zone])countries = if checkout_zone && checkout_zone.kind == 'country'checkout_zone.country_listdiff --git a/core/spec/helpers/base_helper_spec.rb b/core/spec/helpers/base_helper_spec.rbindex c32d304d94..a0f04769f9 100644--- a/core/spec/helpers/base_helper_spec.rb+++ b/core/spec/helpers/base_helper_spec.rb@@ -12,9 +12,24 @@ describe Spree::BaseHelper, type: :helper docreate_list(:country, 3)end+ context 'with checkout zone assigned to the store' do+ before do+ Spree::Config[:checkout_zone] = nil+ @zone = create(:zone, name: 'No Limits')+ @zone.members.create(zoneable: country)+ current_store.update(checkout_zone_id: @zone.id)+ end++ it 'return only the countries defined by the checkout_zone_id' do+ expect(available_countries).to eq([country])+ expect(current_store.checkout_zone_id).to eq @zone.id+ end+ end+context 'with no checkout zone defined' dobefore doSpree::Config[:checkout_zone] = nil+ current_store.update(checkout_zone_id: nil)endit 'return complete list of countries' do