2

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!

1 Answer 1

4

answering self for future seekers:

$item->getParentItemId()

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.