Skip to content

Commit

Permalink
fix: plus wrong discounted price (#4081)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilasw authored Jan 20, 2025
1 parent c4f9866 commit 8c2043f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/shared/src/contexts/PaymentContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type ProductOption = {
label: string;
value: string;
price: string;
priceUnformatted: number;
currencyCode: string;
extraLabel: string;
};
Expand Down Expand Up @@ -165,6 +166,7 @@ export const PaymentContextProvider = ({
label: item.price.description,
value: item.price.id,
price: item.formattedTotals.total,
priceUnformatted: Number(item.totals.total),
currencyCode: productPrices?.data.currencyCode as string,
extraLabel: item.price.customData?.label as string,
})) ?? [],
Expand All @@ -182,7 +184,7 @@ export const PaymentContextProvider = ({
}

return monthlyPrices.reduce((acc, plan) => {
return acc.price < plan.price ? acc : plan;
return acc.priceUnformatted < plan.priceUnformatted ? acc : plan;
}).value;
}, [planTypes, productOptions]);

Expand Down

0 comments on commit 8c2043f

Please sign in to comment.