Class: Spree::Calculator::FreeShipping

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Spree::Calculator

#available?, calculators, #description, register, #to_s

Methods inherited from Base

page

Methods included from Preferences::Preferable

#clear_preferences, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference

Class Method Details

.descriptionObject


7
8
9
# File 'app/models/spree/calculator/free_shipping.rb', line 7

def self.description
  Spree.t(:free_shipping)
end

Instance Method Details

#compute(object) ⇒ Object


11
12
13
14
15
16
17
18
19
20
# File 'app/models/spree/calculator/free_shipping.rb', line 11

def compute(object)
  if object.is_a?(Array)
    return if object.empty?
    order = object.first.order
  else
    order = object
  end

  order.ship_total
end