Class: Spree::Promotion::Actions::FreeShipping

Inherits:
Spree::PromotionAction show all
Includes:
AdjustmentSource
Defined in:
app/models/spree/promotion/actions/free_shipping.rb

Instance Method Summary collapse

Methods inherited from Base

belongs_to_required_by_default, page, spree_base_scopes

Methods included from Spree::Preferences::Preferable

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

Instance Method Details

#compute_amount(shipment) ⇒ Object


12
13
14
# File 'app/models/spree/promotion/actions/free_shipping.rb', line 12

def compute_amount(shipment)
  shipment.cost * -1
end

#perform(payload = {}) ⇒ Object


7
8
9
10
# File 'app/models/spree/promotion/actions/free_shipping.rb', line 7

def perform(payload = {})
  order = payload[:order]
  create_unique_adjustments(order, order.shipments)
end