Question

When looking at the cart from code (for example in the checkout_cart_save_after event), how do I tell which items are part of bundles and which are not?

For example, lets say I have a bundle which is a pack of 4 shirts together with a discount, and those same shirts can also be purchased separately, as simple products.

Now a user added this bundle to cart + 2 of those shirts without any bundle. If I look at the products in cart, by using something like this:

Mage::getModel('checkout/cart')->getQuote()->getAllItems();

I will get a total of 7 items - the bundle product, and 6 shirts.

How can I tell which of the shirts are part of the bundle and which were bought separately?

Thanks!

Was it helpful?

Solution

answering self for future seekers:

$item->getParentItemId()

source: http://davehiren.blogspot.co.il/2014/02/magento-get-cart-items-how-to-get.html

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top