Sha256: 54397be9a05f456a7a9c52603c9019db9db894a20f2cf579310373938354654a
Contents?: true
Size: 560 Bytes
Versions: 110
Compression:
Stored size: 560 Bytes
Contents
require_dependency 'spree/shipping_calculator' module Spree module Calculator::Shipping class PerItem < ShippingCalculator preference :amount, :decimal, default: 0 preference :currency, :string, default: ->{ Spree::Config[:currency] } def self.description Spree.t(:shipping_flat_rate_per_item) end def compute_package(package) compute_from_quantity(package.contents.sum(&:quantity)) end def compute_from_quantity(quantity) self.preferred_amount * quantity end end end end
Version data entries
110 entries across 110 versions & 2 rubygems