We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
To handle shipping fees in your app, there are existing shippings methods with associated calculators, but you can also create your own easily.
Once you have the shipping calculator, you only need to create a ShippingMethod in your database :
ShippingMethod
irb :001> Stall::ShippingMethod.create!(name: 'My shipping method', identifier: 'my_shipping_method')
Create a Stall::Shipping::Calculator subclass in your app's lib/ folder, which defined two methods : #available_for?(address) and #price :
Stall::Shipping::Calculator
lib/
#available_for?(address)
#price
class MyShippingCalculator < Stall::Shipping::Calculator register :my_shipping_calculator def available_for?(address) address.country.in?(['FR', 'GB']) end def price cart.total_price > 100 ? 0 : 10 end end
Note : Inside the class you have access to the current cart, and the config property which is the Stall::ShippingMethod model instance.
cart
config
Stall::ShippingMethod
Require it in the stall initializer :
require 'my-shipping-calculator` Stall.configure do |config| # ... end