From 24908616393614ce37fe1aabfbd9d121fed5e223 Mon Sep 17 00:00:00 2001 From: Andy Brett Date: Thu, 25 Mar 2021 09:59:13 -0700 Subject: [PATCH] show correct values in line_item.rb --- app/models/spree/line_item.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/spree/line_item.rb b/app/models/spree/line_item.rb index df88535a2a..5813511577 100644 --- a/app/models/spree/line_item.rb +++ b/app/models/spree/line_item.rb @@ -220,9 +220,9 @@ module Spree end def unit_price_price_and_unit - price = Spree::Money.new((rand * 10).round(2), currency: currency) - unit = ["item", "kg"].sample - price.to_html + " / " + unit + unit_price = UnitPrice.new(variant) + Spree::Money.new(price_with_adjustments / unit_price.denominator).to_html + + " / " + unit_price.unit end def scoper