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.

Remove `priority` from PriceRule

Damian Legawiec21f9eb1b7c53
diff --git a/core/app/models/spree/price_rule.rb b/core/app/models/spree/price_rule.rb
index 8dfa1103c3..440d1b9af5 100644
--- a/core/app/models/spree/price_rule.rb
+++ b/core/app/models/spree/price_rule.rb
@@ -6,9 +6,6 @@ module Spree
belongs_to :price_list, class_name: 'Spree::PriceList'
validates :type, presence: true
- validates :priority, presence: true, numericality: { only_integer: true }
-
- scope :by_priority, -> { order(priority: :desc) }
def applicable?(context)
raise NotImplementedError, "#{self.class.name} must implement #applicable?"
diff --git a/core/db/migrate/20251110120001_create_spree_price_rules.rb b/core/db/migrate/20251110120001_create_spree_price_rules.rb
index 0979031bf3..7e1ad96256 100644
--- a/core/db/migrate/20251110120001_create_spree_price_rules.rb
+++ b/core/db/migrate/20251110120001_create_spree_price_rules.rb
@@ -3,7 +3,6 @@ class CreateSpreePriceRules < ActiveRecord::Migration[7.0]
create_table :spree_price_rules do |t|
t.belongs_to :price_list, null: false, foreign_key: false, index: true
t.string :type, null: false
- t.integer :priority, null: false, default: 0
t.text :preferences
t.timestamps
t.datetime :deleted_at
@@ -11,7 +10,6 @@ class CreateSpreePriceRules < ActiveRecord::Migration[7.0]
add_index :spree_price_rules, [:price_list_id, :type]
add_index :spree_price_rules, :type
- add_index :spree_price_rules, :priority
add_index :spree_price_rules, :deleted_at
end
end
diff --git a/core/lib/spree/testing_support/factories/price_rule_factory.rb b/core/lib/spree/testing_support/factories/price_rule_factory.rb
index bfd0a3ecb5..e2bcf76ae6 100644
--- a/core/lib/spree/testing_support/factories/price_rule_factory.rb
+++ b/core/lib/spree/testing_support/factories/price_rule_factory.rb
@@ -1,7 +1,6 @@
FactoryBot.define do
factory :price_rule, class: Spree::PriceRule do
price_list
- priority { 0 }
factory :zone_price_rule, class: Spree::PriceRules::ZoneRule do
after(:build) do |rule, evaluator|