Skip to content

armgit / spree

Public Imported from GitHub
0

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.

Move `disable_sku_validation` from Config to RuntimeConfig (#12162)

Damian Legawiec307a902fdde4
diff --git a/core/app/models/spree/variant.rb b/core/app/models/spree/variant.rb
index 1caf03b60c..e35380ccff 100644
--- a/core/app/models/spree/variant.rb
+++ b/core/app/models/spree/variant.rb
@@ -442,7 +442,7 @@ module Spree
end
def disable_sku_validation?
- Spree::Config[:disable_sku_validation]
+ Spree::RuntimeConfig[:disable_sku_validation]
end
end
end
diff --git a/core/lib/spree/core/configuration.rb b/core/lib/spree/core/configuration.rb
index b4eb914588..c7915c867c 100644
--- a/core/lib/spree/core/configuration.rb
+++ b/core/lib/spree/core/configuration.rb
@@ -36,7 +36,7 @@ module Spree
preference :company, :boolean, default: false # Request company field for billing and shipping addr
preference :currency, :string, default: 'USD', deprecated: true
preference :credit_to_new_allocation, :boolean, default: false
- preference :disable_sku_validation, :boolean, default: false # when turned off disables the built-in SKU uniqueness validation
+ preference :disable_sku_validation, :boolean, default: false, deprecated: true # when turned off disables the built-in SKU uniqueness validation
preference :disable_store_presence_validation, :boolean, default: false # when turned off disables Store presence validation for Products and Payment Methods
preference :expedited_exchanges, :boolean, default: false # NOTE this requires payment profiles to be supported on your gateway of choice as well as a delayed job handler to be configured with activejob. kicks off an exchange shipment upon return authorization save. charge customer if they do not return items within timely manner.
preference :expedited_exchanges_days_window, :integer, default: 14 # the amount of days the customer has to return their item after the expedited exchange is shipped in order to avoid being charged
diff --git a/core/lib/spree/core/runtime_configuration.rb b/core/lib/spree/core/runtime_configuration.rb
index 3864038232..4ba23b6c5f 100644
--- a/core/lib/spree/core/runtime_configuration.rb
+++ b/core/lib/spree/core/runtime_configuration.rb
@@ -5,6 +5,7 @@ module Spree
class RuntimeConfiguration < Preferences::RuntimeConfiguration
preference :always_use_translations, :boolean, default: false
preference :allow_empty_price_amount, :boolean, default: false
+ preference :disable_sku_validation, :boolean, default: false
end
end
end
diff --git a/core/spec/models/spree/variant_spec.rb b/core/spec/models/spree/variant_spec.rb
index 9cd5ae37ab..f79421e5b5 100644
--- a/core/spec/models/spree/variant_spec.rb
+++ b/core/spec/models/spree/variant_spec.rb
@@ -51,11 +51,11 @@ describe Spree::Variant, type: :model do
context 'disabled validation' do
before do
- Spree::Config[:disable_sku_validation] = true
+ Spree::RuntimeConfig[:disable_sku_validation] = true
end
after do
- Spree::Config[:disable_sku_validation] = false
+ Spree::RuntimeConfig[:disable_sku_validation] = false
end
context 'valid' do