Class: Spree::PriceRules::ZoneRule
- Inherits:
-
Spree::PriceRule
- Object
- Spree::PriceRule
- Spree::PriceRules::ZoneRule
- Defined in:
- app/models/spree/price_rules/zone_rule.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Spree::PriceRule
Class Method Details
.description ⇒ Object
14 15 16 |
# File 'app/models/spree/price_rules/zone_rule.rb', line 14 def self.description 'Apply pricing based on the tax/shipping zone' end |
Instance Method Details
#applicable?(context) ⇒ Boolean
6 7 8 9 10 11 12 |
# File 'app/models/spree/price_rules/zone_rule.rb', line 6 def applicable?(context) return false unless context.zone return true if preferred_zone_ids.empty? # Compare as strings to support both integer and UUID primary keys preferred_zone_ids.map(&:to_s).include?(context.zone.id.to_s) end |