Sha256: 82993489b923c147de8feec6d7f980ecfba44893224ba495f8a4b830f962a267
Contents?: true
Size: 512 Bytes
Versions: 28
Compression:
Stored size: 512 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) content_items = package.contents self.preferred_amount * content_items.sum { |item| item.quantity } end end end end
Version data entries
28 entries across 28 versions & 1 rubygems