Skip to content

Commit

Permalink
feat: discount for coupons who has the fixed price disc
Browse files Browse the repository at this point in the history
  • Loading branch information
xabg2 committed Aug 26, 2024
1 parent f4a8801 commit 2efddca
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app/payment/components/checkout/ProductCardComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ export const ProductFeaturesComponent = ({
const planAmount = getProductAmount(selectedPlan.decimalAmount, couponCodeData).toFixed(2);
const upsellPlanAmount = upsellManager.amount && getProductAmount(upsellManager.amount, couponCodeData).toFixed(2);

const discountPercentage =
couponCodeData?.amountOff && couponCodeData?.amountOff < selectedPlan.amount
? ((couponCodeData?.amountOff / selectedPlan.amount) * 100).toFixed(2)
: undefined;

return (
<div className="flex w-full flex-col space-y-4 overflow-y-auto">
<div className="flex w-full flex-row items-center justify-between space-x-4">
Expand Down Expand Up @@ -91,7 +96,7 @@ export const ProductFeaturesComponent = ({
<SealPercent weight="fill" size={24} />
<p className="">
{translate('checkout.productCard.saving', {
percent: couponCodeData?.percentOff,
percent: couponCodeData?.percentOff ?? discountPercentage,
})}
</p>
</div>
Expand Down

0 comments on commit 2efddca

Please sign in to comment.