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

Methods included from Core::Permalinks

#generate_permalink, #save_permalink

Instance Method Details

#display_priceObject Also known as: display_cost



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

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:,
         explanations: tax_explanations
end