Sha256: f5aad9a755a3b9457dc8d6fcda2c9d7f05ccf2e624c10aa6618a6b40d723fc10
Contents?: true
Size: 594 Bytes
Versions: 9
Compression:
Stored size: 594 Bytes
Contents
# A rule to limit a promotion to a specific user. module Spree class Promotion module Rules class 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 end end
Version data entries
9 entries across 9 versions & 1 rubygems