MCPcopy Create free account
hub / github.com/Source-Controller/eCommerce-Fullstack / onRemove

Function onRemove

context/StateContext2.js:42–49  ·  view source on GitHub ↗
(product)

Source from the content-addressed store, hash-verified

40 }
41
42 const onRemove = (product) => {
43 foundProduct = cartItems.find((item) => item._id === product._id)
44 const AddNewCartItems = cartItems.filter(item => item._id !== product._id);
45
46 setTotalPrice(prevTotalPrice => prevTotalPrice - foundProduct.price * foundProduct.quantity)
47 setTotalQty(prevTotalQty => prevTotalQty - foundProduct.quantity);
48 setCartItems(AddNewCartItems);
49 }
50
51 const toggleCartItemQuantity = (id, value) => {
52 foundProduct = cartItems.find((item) => item._id === id)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected