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 `has_markets?` check in Store model
Damian Legawiece466ad278a96
diff --git a/backend/engines/core/app/models/concerns/spree/stores/markets.rb b/backend/engines/core/app/models/concerns/spree/stores/markets.rbindex c713ec674b..f7a8d2bbc1 100644--- a/backend/engines/core/app/models/concerns/spree/stores/markets.rb+++ b/backend/engines/core/app/models/concerns/spree/stores/markets.rb@@ -17,14 +17,22 @@ module Spree# Falls back to the store's own default_locale column# @return [String, nil]def default_locale- default_market&.default_locale || read_attribute(:default_locale)+ if has_markets?+ default_market&.default_locale || read_attribute(:default_locale)+ else+ read_attribute(:default_locale)+ endend# Returns the default currency, delegating to the default market when markets exist# Falls back to the store's own default_currency column# @return [String, nil]def default_currency- default_market&.currency || read_attribute(:default_currency)+ if has_markets?+ default_market&.currency || read_attribute(:default_currency)+ else+ read_attribute(:default_currency)+ endend# Returns the market that contains the given country@@ -70,6 +78,10 @@ module Spreeprivate+ def has_markets?+ persisted? && (markets.loaded? ? markets.any? : markets.exists?)+ end+def legacy_supported_currencies_list([default_currency] + read_attribute(:supported_currencies).to_s.split(',')).uniq.map(&:to_s).map do |code|::Money::Currency.find(code.strip)