Class: Spree::PriceRules::VolumeRule
- Inherits:
-
Spree::PriceRule
- Object
- Spree::PriceRule
- Spree::PriceRules::VolumeRule
- Defined in:
- app/models/spree/price_rules/volume_rule.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Spree::PriceRule
Class Method Details
.description ⇒ Object
16 17 18 |
# File 'app/models/spree/price_rules/volume_rule.rb', line 16 def self.description 'Apply pricing based on quantity purchased' end |
Instance Method Details
#applicable?(context) ⇒ Boolean
7 8 9 10 11 12 13 14 |
# File 'app/models/spree/price_rules/volume_rule.rb', line 7 def applicable?(context) return false unless context.quantity return false if context.quantity < preferred_min_quantity return false if preferred_max_quantity && context.quantity > preferred_max_quantity true end |