From eca29fb5401eddefe1eb4d6f979b4abd0a1309a4 Mon Sep 17 00:00:00 2001
From: Hrishikesh Vaipurkar
Date: Mon, 28 Jul 2025 11:20:49 +0000
Subject: [PATCH] Merged in fix/SW-3091-the-strikethrough-price- (pull request
#2567)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
fix(SW-3091): Fixed strikethrough price for logged-in user
* fix(SW-3091): Fixed strikethrough price for logged-in user
Approved-by: Anton Gunnarsson
Approved-by: Matilda Landström
---
.../RateSummary/MobileSummary/Room/index.tsx | 14 +++++--------
.../RateSummary/MobileSummary/utils.ts | 20 -------------------
2 files changed, 5 insertions(+), 29 deletions(-)
diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Room/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Room/index.tsx
index 5f04d2c79..bad97fe03 100644
--- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Room/index.tsx
+++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Room/index.tsx
@@ -12,11 +12,7 @@ import { getRoomPrice } from "@/stores/enter-details/helpers"
import Modal from "@/components/Modal"
import { formatPrice } from "@/utils/numberFormatting"
-import {
- getMemberPrice,
- getNonDiscountedRate,
- isBookingCodeRate,
-} from "../utils"
+import { getMemberPrice, isBookingCodeRate } from "../utils"
import styles from "./room.module.css"
@@ -151,12 +147,12 @@ export default function Room({
)}
{/* Show the price on which discount applies as Striked when discounted price is available */}
- {showDiscounted ? (
+ {showDiscounted && regularRate.perStay.local.regularPrice ? (
- {getNonDiscountedRate(
+ {formatPrice(
intl,
- showMemberPrice,
- regularRate.perStay
+ regularRate.perStay.local.regularPrice,
+ regularRate.perStay.local.currency
)}
) : null}
diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/utils.ts b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/utils.ts
index ee63c2b07..ee5f420f2 100644
--- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/utils.ts
+++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/utils.ts
@@ -1,12 +1,8 @@
import { RateTypeEnum } from "@scandic-hotels/trpc/enums/rateType"
-import { formatPrice } from "@/utils/numberFormatting"
-
import type { Product } from "@scandic-hotels/trpc/types/roomAvailability"
-import type { IntlShape } from "react-intl"
import type { RoomRate } from "@/types/components/hotelReservation/enterDetails/details"
-import type { Price } from "@/types/components/hotelReservation/price"
export function getMemberPrice(roomRate: RoomRate) {
if ("member" in roomRate && roomRate.member) {
@@ -37,19 +33,3 @@ export function isBookingCodeRate(product: Product) {
return false
}
}
-
-export function getNonDiscountedRate(
- intl: IntlShape,
- isMemberRate: boolean,
- rate: Price
-) {
- if (isMemberRate) {
- return rate.local.price
- ? formatPrice(intl, rate.local.price, rate.local.currency)
- : null
- } else {
- return rate.local.regularPrice
- ? formatPrice(intl, rate.local.regularPrice, rate.local.currency)
- : null
- }
-}