From 416e2f6d000c0fb178a3bcbd82155062138568d3 Mon Sep 17 00:00:00 2001 From: IceToast Date: Tue, 6 Jun 2023 15:48:26 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Show=20coupon=20result=20?= =?UTF-8?q?with=20amount?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/default/views/store/checkout.blade.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/themes/default/views/store/checkout.blade.php b/themes/default/views/store/checkout.blade.php index c9308548..20e8bf91 100644 --- a/themes/default/views/store/checkout.blade.php +++ b/themes/default/views/store/checkout.blade.php @@ -178,7 +178,7 @@ @if ($discountpercent && $discountvalue)
- {{ __('Discount') }} + {{ __('Partner Discount') }} ({{ $discountpercent }}%) -{{ $product->formatToCurrency($discountvalue) }} @@ -296,24 +296,26 @@ calcPriceWithCouponDiscount(couponValue, couponType) { let newTotalPrice = this.totalPrice + + console.log(couponType) if (couponType === 'percentage') { newTotalPrice = newTotalPrice - (newTotalPrice * couponValue / 100) this.couponDiscountedValue = "- " + couponValue + "%" } else if (couponType === 'amount') { - newTotalPrice = totanewTotalPricelPrice - couponValue - this.couponDiscountedValue = "- " + couponValue + " {{ $product->currency_code }}" + + newTotalPrice = newTotalPrice - couponValue + this.couponDiscountedValue = "- " + this.formatToCurrency(couponValue) } - // get language for formatting currency - const lang = "{{ app()->getLocale() }}" // format totalPrice to currency this.totalPrice = this.formatToCurrency(newTotalPrice) }, formatToCurrency(amount) { - // get language for formatting currency - const lang = "{{ app()->getLocale() }}" - console.log(lang) + // get language for formatting currency - use en_US as product->formatToCurrency() uses it + //const lang = "{{ app()->getLocale() }}" + const lang = 'en-US' + // format totalPrice to currency return amount.toLocaleString(lang, { style: 'currency',