Sha256: 11acf0a850c5be329a02aa71606eb6dfaeac2f15af0a3191f6fc3d5f075a78da
Contents?: true
Size: 523 Bytes
Versions: 4
Compression:
Stored size: 523 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 => '>' attr_accessible :preferred_amount, :preferred_operator 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
4 entries across 4 versions & 1 rubygems