From 915337aee73e3182730f919eee18e6bdbd2f553f Mon Sep 17 00:00:00 2001 From: DucHuy2801 Date: Tue, 7 May 2024 22:50:44 +0700 Subject: [PATCH] fix new price when increase child quantity --- server/src/controllers/cart.controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/controllers/cart.controller.js b/server/src/controllers/cart.controller.js index 9c40cf0..96476b2 100644 --- a/server/src/controllers/cart.controller.js +++ b/server/src/controllers/cart.controller.js @@ -201,11 +201,11 @@ class CartController { order_item.child_quantity++; order_item.quantity++; - order_item.total_price = parseFloat(order_item.total_price) + parseFloat(tour.price) + order_item.total_price = parseFloat(order_item.total_price) + parseFloat(0.75 * tour.price) await order_item.save() - const new_total = parseFloat(cart.total) + parseFloat(0.75 * order_item.price) + const new_total = parseFloat(cart.total) + parseFloat(0.75 * tour.price) cart.total = new_total; await cart.save()