Sha256: 3afc8800d8680f12f6de696a719b942ffd6c5d03f17e477207efaaf9623dee90
Contents?: true
Size: 463 Bytes
Versions: 11
Compression:
Stored size: 463 Bytes
Contents
# A rule to limit a promotion to a specific user. module Spree class Promotion::Rules::ItemTotal < PromotionRule preference :amount, :decimal, :default => 100.00 preference :operator, :string, :default => '>' OPERATORS = ['gt', 'gte'] def eligible?(order, options = {}) item_total = order.line_items.map(&:amount).sum item_total.send(preferred_operator == 'gte' ? :>= : :>, BigDecimal.new(preferred_amount.to_s)) end end end
Version data entries
11 entries across 11 versions & 1 rubygems