Class: Spree::Calculator::FlatFee

Inherits:
Spree::Calculator show all
Defined in:
app/models/spree/calculator/flat_fee.rb

Overview

Very simple tax rate calculator. Can be used to apply a flat fee to any type of item, including an order.

Instance Method Summary collapse

Methods inherited from Spree::Calculator

#available?, #description, description, #to_s

Methods inherited from Base

display_includes

Methods included from Spree::Core::Permalinks

#generate_permalink, #save_permalink

Instance Method Details

#compute(_object) ⇒ Object Also known as: compute_order, compute_shipment, compute_line_item, compute_shipping_rate

Amount is fixed regardles of what it's being applied to.


12
13
14
# File 'app/models/spree/calculator/flat_fee.rb', line 12

def compute(_object)
  rate.active? ? rate.amount : 0
end