April 2020
Intermediate to advanced
716 pages
18h 55m
English
If the seller wishes to cancel the order for a product and selects Cancelled from the status values dropdown for a specific product in the order, we will call the cancelProduct fetch method inside the handleStatusChange method, as shown in the following code.
mern-marketplace/client/order/ProductOrderEdit.js:
cancelProduct({ shopId: props.shopId, productId: product.product._id }, { t: jwt.token }, { cartItemId: product._id, status: event.target.value, quantity: product.quantity }) .then((data) => { if (data.error) { setValues({ ...values, error: "Status not updated, try again" }) } else { props.updateOrders(props.orderIndex, order) setValues({ ...values, error: '' }) } })
The cancelProduct fetch ...
Read now
Unlock full access