Reduce stock after purchase

  • Post author:
  • Post category:
  • Post comments:0 Comments

hello there, fist of all don't use this code: <code>[apcode language="jscript"] order.orderItems?.map((item) => {         axios.put(           `/api/products/${parseInt(item._id.id)}`,           {             _id: parseInt(item._id.id),             user,             price,             isPaid,             isDelivered,             countInStock,           },           {             headers: { Authorization: `Bearer…

Continue ReadingReduce stock after purchase

Lesson16. Cart screen doesnt work properly, shows last item, not list when you buy 2 different ones

  • Post author:
  • Post category:
  • Post comments:4 Comments

hello there, you have 2 product with same id in the cart items. based on this condition: https://github.com/basir/mern-amazona/blob/master/frontend/src/Store.js#L33 we don't let having 2 products with same _id in the cart.…

Continue ReadingLesson16. Cart screen doesnt work properly, shows last item, not list when you buy 2 different ones