fix discount calculating

This commit is contained in:
2025-11-05 18:24:34 +03:00
parent 4f6f3e146e
commit 27f522e75c
2 changed files with 15 additions and 7 deletions

View File

@@ -44,13 +44,17 @@ export default function OrderSummary() {
<ProText type="secondary">{t("cart.basketTotal")}</ProText> <ProText type="secondary">{t("cart.basketTotal")}</ProText>
<ArabicPrice price={subtotal} /> <ArabicPrice price={subtotal} />
</div> </div>
{orderType != OrderType.DineIn && <div className={styles.summaryRow}> {orderType != OrderType.DineIn && (
<div className={styles.summaryRow}>
<ProText type="secondary">{t("cart.deliveryFee")}</ProText> <ProText type="secondary">{t("cart.deliveryFee")}</ProText>
<ArabicPrice price={Number(restaurant?.delivery_fees || 0)} /> <ArabicPrice price={Number(restaurant?.delivery_fees || 0)} />
</div>} </div>
)}
<div className={styles.summaryRow}> <div className={styles.summaryRow}>
<ProText type="secondary">{t("cart.discount")}</ProText> <ProText type="secondary">{t("cart.discount")}</ProText>
<ArabicPrice price={highestLoyaltyItem?.price || 0} /> <ArabicPrice
price={useLoyaltyPoints ? highestLoyaltyItem?.price || 0 : 0}
/>
</div> </div>
<div className={styles.summaryRow}> <div className={styles.summaryRow}>
<ProText type="secondary">{t("cart.tax")}</ProText> <ProText type="secondary">{t("cart.tax")}</ProText>

View File

@@ -650,7 +650,11 @@ export const selectGrandTotal = (state: RootState) => {
? Number(state.order.restaurant?.delivery_fees) || 0 ? Number(state.order.restaurant?.delivery_fees) || 0
: 0; : 0;
return subtotal + taxAmount - loyaltyDiscount + deliveryFee; return (
}; subtotal +
taxAmount -
(state.order.useLoyaltyPoints ? loyaltyDiscount : 0) +
deliveryFee
);};
export default orderSlice.reducer; export default orderSlice.reducer;