Class: Spree::ShippingRate

Inherits:
Base
  • Object
show all
Extended by:
DisplayMoney
Defined in:
app/models/spree/shipping_rate.rb

Overview

Records the costs of different shipping methods for a shipment and which method has been selected to deliver the shipment.

Instance Method Summary (collapse)

Methods included from DisplayMoney

money_methods

Methods inherited from Base

display_includes, #initialize_preference_defaults, page, preference

Methods included from Preferences::Preferable

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

Instance Method Details

- (Object) display_price Also known as: display_cost



24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/models/spree/shipping_rate.rb', line 24

def display_price
  price = display_amount.to_s

  return price if taxes.empty? || amount == 0

  tax_explanations = taxes.map(&:label).join(tax_label_separator)

  Spree.t :display_price_with_explanations,
           scope: 'shipping_rate.display_price',
           price: price,
           explanations: tax_explanations
end