Class: Spree::Promotion::Rules::NthOrder
- Inherits:
-
Spree::PromotionRule
- Object
- Base
- Spree::PromotionRule
- Spree::Promotion::Rules::NthOrder
- Defined in:
- app/models/spree/promotion/rules/nth_order.rb
Instance Method Summary collapse
-
#applicable?(promotable) ⇒ Boolean
This promotion is applicable to orders only.
-
#eligible?(order, _options = {}) ⇒ Boolean
This is never eligible if the order does not have a user, and that user does not have any previous completed orders.
Methods inherited from Spree::PromotionRule
#actionable?, #eligibility_errors, #preload_relations, #to_partial_path
Instance Method Details
#applicable?(promotable) ⇒ Boolean
This promotion is applicable to orders only.
13 14 15 |
# File 'app/models/spree/promotion/rules/nth_order.rb', line 13 def applicable?(promotable) promotable.is_a?(Spree::Order) end |
#eligible?(order, _options = {}) ⇒ Boolean
This is never eligible if the order does not have a user, and that user does not have any previous completed orders.
Use the first order rule if you want a promotion to be applied to the first order for a user.
21 22 23 24 25 |
# File 'app/models/spree/promotion/rules/nth_order.rb', line 21 def eligible?(order, = {}) return false unless order.user nth_order?(order) end |