Sha256: de1fbffa76c99daa50dfcb0d81cd7d4b1ca55c47de4b563c339136d69db792bf
Contents?: true
Size: 567 Bytes
Versions: 13
Compression:
Stored size: 567 Bytes
Contents
# A rule to apply to an order greater than (or greater than or equal to) # a specific amount module Spree class Promotion module Rules class 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 end end
Version data entries
13 entries across 13 versions & 1 rubygems