 Caught an error while pushing a product to cart. TypeError: Cannot read property 'push' of undefined
            
               Caught an error while pushing a product to cart. TypeError: Cannot read property 'push' of undefined
            
        
        
      
          0
        
        I want to push the product details into the cart model when a user clicks on "add to cart" button on a particular product. But it shows TypeError: Cannot read property 'push' of undefined
Here is the route file:
router.post("/product/:id/addCart", isLoggedIn, function(req, res){
const quantity = req.body.quantity
Product.findById(req.params.id, function(err, foundProduct){ 

 
    
Top comments (0)