Skip to content

Commit

Permalink
fix new price when increase child quantity
Browse files Browse the repository at this point in the history
  • Loading branch information
DucHuy2801 committed May 7, 2024
1 parent 68c9c45 commit 915337a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/src/controllers/cart.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 915337a

Please sign in to comment.