From 5b8e0d734f9cad963b4e5b56f7ef945f42412539 Mon Sep 17 00:00:00 2001 From: Gaetan Craig-Riou Date: Wed, 9 Oct 2024 11:02:24 +1100 Subject: [PATCH] Use Spree::Money to display prices This is to ensure the correct currency and currency configuration is applied. --- .../admin/products_v3/product_preview.turbo_stream.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/admin/products_v3/product_preview.turbo_stream.haml b/app/views/admin/products_v3/product_preview.turbo_stream.haml index 61935d012c..061af81b91 100644 --- a/app/views/admin/products_v3/product_preview.turbo_stream.haml +++ b/app/views/admin/products_v3/product_preview.turbo_stream.haml @@ -59,18 +59,18 @@ .variant-unit = variant.unit_to_display .small-4.medium-3.columns.variant-price - = number_to_currency(variant.price) + = Spree::Money.new(variant.price) .unit-price.variant-unit-price = render AdminTooltipComponent.new(text: t("js.shopfront.unit_price_tooltip"), link_text: "", placement: "top", link_class: "question-mark-icon") - # TODO use an helper - unit_price = UnitPrice.new(variant) - price_per_unit = variant.price / (unit_price.denominator || 1) - = "#{number_to_currency(price_per_unit)} / #{unit_price.unit}".html_safe + = "#{Spree::Money.new(price_per_unit)} / #{unit_price.unit}".html_safe .medium-3.columns.total-price %span - = number_to_currency(0.00) + = Spree::Money.new(0.00) .small-5.medium-3.large-3.columns.variant-quantity-column.text-right .variant-quantity-inputs %button.add-variant