11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/helpers/my_quotes_helper.rb', line 11
def display_discounted_shipping_price(quote)
shipping_cost = quote.line_items.shipping_only.to_a.sum { |li| li.price_total }
discounted_shipping_cost = quote.discounted_shipping_total
currency_symbol = begin
quote.currency_symbol
rescue StandardError
Money::Currency.new('USD').symbol
end
if shipping_cost == discounted_shipping_cost
number_to_currency(shipping_cost, unit: currency_symbol)
else
tag.del(number_to_currency(shipping_cost, unit: currency_symbol)) + ' ' +
content_tag(:span, number_to_currency(discounted_shipping_cost, unit: currency_symbol), class: 'text-danger fw-bold')
end
end
|