From 436a45b7f2fd8206b01d7943d86cf728529a1773 Mon Sep 17 00:00:00 2001 From: Stephon Brown Date: Wed, 28 Jan 2026 14:33:45 -0500 Subject: [PATCH] Revert "feat(pricing): Add quantity support to discount labels" This reverts commit 8350fdd90f0de7f0d7675cd1be5a22cba34ed3fe. --- libs/pricing/src/types/discount.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/libs/pricing/src/types/discount.ts b/libs/pricing/src/types/discount.ts index 7b651b4ef31..04a03caf381 100644 --- a/libs/pricing/src/types/discount.ts +++ b/libs/pricing/src/types/discount.ts @@ -7,24 +7,13 @@ export const DiscountTypes = { export type DiscountType = (typeof DiscountTypes)[keyof typeof DiscountTypes]; -/** - * Represents a discount that can be applied to a price. - * - type: The type of discount (amount-off or percent-off). - * - value: The value of the discount. For amount-off, this is a fixed amount (e.g., 5 for $5 off). - * For percent-off, this is a percentage (e.g., 10 for 10% off). - * - translationKey: An optional key for localization of the discount label. - * - quantity: An optional quantity associated with the discount (e.g., number of items). - * note: when quantity is provided, it is displayed in the label instead of the value. - */ export type Discount = { type: DiscountType; value: number; translationKey?: string; - quantity?: number; }; export const getLabel = (i18nService: I18nService, discount: Discount): string => { - const showQuantity = discount.quantity != null && discount.quantity > 0; switch (discount.type) { case DiscountTypes.AmountOff: { const formattedAmount = new Intl.NumberFormat("en-US", { @@ -33,7 +22,7 @@ export const getLabel = (i18nService: I18nService, discount: Discount): string = minimumFractionDigits: 2, maximumFractionDigits: 2, }).format(discount.value); - return `${showQuantity ? discount.quantity : formattedAmount} ${i18nService.t(discount.translationKey ?? "discount")}`; + return `${formattedAmount} ${i18nService.t(discount.translationKey ?? "discount")}`; } case DiscountTypes.PercentOff: { const percentValue = discount.value < 1 ? discount.value * 100 : discount.value;