Sha256: 049d447122b3f938e1339a6182623c5f36514f24b71ccd03918f98e45249c9fb

Contents?: true

Size: 646 Bytes

Versions: 86

Compression:

Stored size: 646 Bytes

Contents

# frozen_string_literal: true

module Spree
  class Promotion
    module Rules
      class Store < PromotionRule
        has_many :promotion_rule_stores, class_name: "Spree::PromotionRuleStore",
                                         foreign_key: :promotion_rule_id,
                                         dependent: :destroy
        has_many :stores, through: :promotion_rule_stores, class_name: "Spree::Store"

        def applicable?(promotable)
          promotable.is_a?(Spree::Order)
        end

        def eligible?(order, _options = {})
          stores.none? || stores.include?(order.store)
        end
      end
    end
  end
end

Version data entries

86 entries across 86 versions & 2 rubygems

Version Path
solidus_core-3.1.9 app/models/spree/promotion/rules/store.rb
solidus_core-3.1.8 app/models/spree/promotion/rules/store.rb
solidus_core-3.0.8 app/models/spree/promotion/rules/store.rb
solidus_core-3.0.7 app/models/spree/promotion/rules/store.rb
solidus_core-2.11.17 app/models/spree/promotion/rules/store.rb
solidus_core-3.1.7 app/models/spree/promotion/rules/store.rb
solidus_core-2.11.16 app/models/spree/promotion/rules/store.rb
solidus_core-3.0.6 app/models/spree/promotion/rules/store.rb
solidus_core-3.1.6 app/models/spree/promotion/rules/store.rb
solidus_core-2.11.15 app/models/spree/promotion/rules/store.rb
solidus_core-2.11.14 app/models/spree/promotion/rules/store.rb
solidus_core-3.0.5 app/models/spree/promotion/rules/store.rb
solidus_core-3.1.5 app/models/spree/promotion/rules/store.rb
solidus_core-2.11.13 app/models/spree/promotion/rules/store.rb
solidus_core-3.0.4 app/models/spree/promotion/rules/store.rb
solidus_core-3.1.4 app/models/spree/promotion/rules/store.rb
solidus_core-2.11.12 app/models/spree/promotion/rules/store.rb
solidus_core-3.0.3 app/models/spree/promotion/rules/store.rb
solidus_core-3.1.3 app/models/spree/promotion/rules/store.rb
solidus_core-3.1.2 app/models/spree/promotion/rules/store.rb