544 viewsMern Amazona

Hello, there is a flaw: when we finish to complete the cart, we can go to Applications>Cookies and edit the cartItems>[item]>price

To fix it : in ADD_ITEM_CART change the newItem to {name: action.payload.name, slug: action.payload.slug} Then when u map the cartItems, just search for each item : the item there is on data.js/database Works for me.

Bassir Answered question April 8, 2023

hello there,

you can have double check here:

https://github.com/basir/mern-amazona/blob/8eca70eaf3d656ee654dac2e3b235e6debc07f90/backend/routes/orderRoutes.js#L34

for(const item in order.orderItems) {

cont product = await Product.findById(item.product);

item.price = product.price;

}

then calculate totalPrice based on the item.price

Bassir Answered question April 8, 2023
You are viewing 1 out of 1 answers, click here to view all answers.