Sha256: 7ead7fe191038875ca2020d7e0dba007df0dc86a074e9cbdb66b5a1fea0833c5
Contents?: true
Size: 454 Bytes
Versions: 19
Compression:
Stored size: 454 Bytes
Contents
require_dependency 'spree/shipping_calculator' module Spree module Calculator::Shipping class FlatPercentItemTotal < ShippingCalculator preference :flat_percent, :decimal, default: 0 def compute_package(package) compute_from_price(total(package.contents)) end def compute_from_price(price) value = price * BigDecimal(preferred_flat_percent.to_s) / 100.0 value.round(2) end end end end
Version data entries
19 entries across 19 versions & 1 rubygems