I need to get quote item id of the product when it is added to cart because I need to update a field of Db after this event,I have taken reference from How to get Quote Item Id after adding a product to cart?, but this is not working,I have used event: sales_quote_product_add_after and my oberver function is:
$quoteItem = $observer->getEvent()->getQuoteItem();
$id = $quoteItem->getId();
also I have tried with
$id = $quoteItem->getItemId();
It is throwing following Fatal error:
Fatal error</b>: Call to a member function getId() on a non-object in <b>C:\xampp\htdocs\project\app\code\local\Custom\Module\Model\Observer.php</b> on line <b>1053</b><br />
Please let me know what I am doing wrong,I have taken reference from many other links too but none of them is working.