Module: SolidusPromotions::Conditions::LineItemApplicableOrderLevelCondition
- Included in:
- OptionValue, Product, Taxon
- Defined in:
- app/models/concerns/solidus_promotions/conditions/line_item_applicable_order_level_condition.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
6 7 8 |
# File 'app/models/concerns/solidus_promotions/conditions/line_item_applicable_order_level_condition.rb', line 6 def self.included(klass) klass.preference :line_item_applicable, :boolean, default: true end |
Instance Method Details
#applicable?(promotable) ⇒ Boolean
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/concerns/solidus_promotions/conditions/line_item_applicable_order_level_condition.rb', line 10 def applicable?(promotable) if preferred_line_item_applicable == false Spree.deprecator.warn <<~MSG Setting `#{self.class.name}#preferred_line_item_applicable` to false is deprecated. Please use a suitable condition that only checks the order instead, such as `OrderProduct`, `OrderTaxon`, or `OrderOptionValue`. If you have included the `LineItemApplicableOrderLevelCondition` module yourself, create a new condition that only checks orders: ``` class MyCondition < SolidusPromotions::Condition def order_eligible?(order, _options = {}) # your logic here end end ``` MSG end promotable.is_a?(Spree::LineItem) ? preferred_line_item_applicable && super : super end |
#level ⇒ Object
29 30 31 |
# File 'app/models/concerns/solidus_promotions/conditions/line_item_applicable_order_level_condition.rb', line 29 def level :order end |