Sha256: 9fe3e025600cfd32a6061c62d8f318bd345824cd4d9ce94f9c4307d8800a9c9c
Contents?: true
Size: 487 Bytes
Versions: 26
Compression:
Stored size: 487 Bytes
Contents
require_dependency 'spree/calculator' module Spree class Calculator::FlatPercentItemTotal < Calculator preference :flat_percent, :decimal, default: 0 def compute(object) computed_amount = (object.amount * preferred_flat_percent / 100).round(2) # We don't want to cause the promotion adjustments to push the order into a negative total. if computed_amount > object.amount object.amount else computed_amount end end end end
Version data entries
26 entries across 26 versions & 1 rubygems