- Add initializer to
config/application.rb
- Add new class to
app/models/spree/calculators/[class_name].rb
- Add logic to class file
Class must have the following methods:
def self.description
"Custom FlexiRate"
end
def compute(line_items)
13.00
end
How do i know that the calculator is registered and is called?
I create a new calculator:
module Spree class Calculator::SizeRate < Spree::Calculator def self.description # Human readable description of the calculator "Calculadora segun el tamaño del banner" end def compute(object=nil) 99 end end end
and registered here:
config.spree.calculators.promotion_actions_create_adjustments << Spree::Calculator::SizeRate
but when i create an order or update something nothing happens