Sha256: 24453b6508bccd95d220c94dda7d58788cf7178e305365ea443b5e632a20511d
Contents?: true
Size: 767 Bytes
Versions: 110
Compression:
Stored size: 767 Bytes
Contents
require_dependency 'spree/shipping_calculator' module Spree module Calculator::Shipping class PriceSack < ShippingCalculator preference :minimal_amount, :decimal, default: 0 preference :normal_amount, :decimal, default: 0 preference :discount_amount, :decimal, default: 0 preference :currency, :string, default: ->{ Spree::Config[:currency] } def self.description Spree.t(:shipping_price_sack) end def compute_package(package) compute_from_price(total(package.contents)) end def compute_from_price(price) if price < self.preferred_minimal_amount self.preferred_normal_amount else self.preferred_discount_amount end end end end end
Version data entries
110 entries across 110 versions & 2 rubygems