Class: SolidusFriendlyPromotions::Conditions::NthOrder

Inherits:
SolidusFriendlyPromotions::Condition show all
Includes:
OrderLevelCondition
Defined in:
app/models/solidus_friendly_promotions/conditions/nth_order.rb

Instance Method Summary collapse

Methods included from OrderLevelCondition

#applicable?, #level

Methods inherited from SolidusFriendlyPromotions::Condition

#applicable?, #eligibility_errors, #level, #preload_relations, #to_partial_path, #updateable?

Instance Method Details

#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 condition if you want a promotion to be applied to the first order for a user.

Parameters:

  • order (Spree::Order)

Returns:

  • (Boolean)


17
18
19
20
21
# File 'app/models/solidus_friendly_promotions/conditions/nth_order.rb', line 17

def eligible?(order, _options = {})
  return false unless order.user

  nth_order?(order)
end