Magento – Event checkout_cart_add_product_complete – Get Quote Item (follow up question)

cartevent-observer

I'm observing the checkout_cart_add_product_complete event and need to get the added quote item.

There was a previous post on this issue with a suggestion to flag the new quote item in checkout_cart_product_add_after and then access it in checkout_cart_add_product_complete.

My question is on a basic level – how exactly do I implement this solution if I only get passed the product in checkout_cart_add_product_complete?

Link to previous post: Watching Add to Cart Event – quote item id is empty

Best Answer

You get the quote by:

$quote = Mage::getSingleton('checkout/cart')->getQuote();

then you have access to all items:

$quote->getAllItems()

And follow the instructions of the original answer