Class: Spree::ShippingRate
- Inherits:
-
Base
- Object
- ApplicationRecord
- Base
- Spree::ShippingRate
show all
- Extended by:
- DisplayMoney
- Defined in:
- app/models/spree/shipping_rate.rb
Instance Method Summary
collapse
money_methods
Methods inherited from Base
belongs_to_required_by_default, page, spree_base_scopes
#clear_preferences, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference
Instance Method Details
#base_price ⇒ Object
15
16
17
|
# File 'app/models/spree/shipping_rate.rb', line 15
def base_price
cost
end
|
#display_price ⇒ Object
Also known as:
display_cost
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/models/spree/shipping_rate.rb', line 19
def display_price
price = display_base_price.to_s
return price if tax_rate.nil? || tax_amount == 0
Spree.t tax_rate.included_in_price? ? :including_tax : :excluding_tax,
scope: 'shipping_rates.display_price',
price: price,
tax_amount: display_tax_amount,
tax_rate_name: tax_rate.name
end
|
#shipping_method ⇒ Object
36
37
38
|
# File 'app/models/spree/shipping_rate.rb', line 36
def shipping_method
Spree::ShippingMethod.unscoped { super }
end
|
#tax_amount ⇒ Object
32
33
34
|
# File 'app/models/spree/shipping_rate.rb', line 32
def tax_amount
@_tax_amount ||= tax_rate.calculator.compute_shipping_rate(self)
end
|
#tax_rate ⇒ Object
40
41
42
|
# File 'app/models/spree/shipping_rate.rb', line 40
def tax_rate
Spree::TaxRate.unscoped { super }
end
|