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

#display_priceObject Also known as: display_cost



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

def display_price
  price = display_amount.to_s

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

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

  I18n.t 'spree.shipping_rate.display_price.display_price_with_explanations',
         price: price,
         explanations: tax_explanations
end