Products having associated crossell products should also be removed if i remove the main products in magento2.1.7 see my screenshot below..enter image description here

Here the flower is the main product(ie,simple product) and the teddy bear is its associated crossell product..if i remove the flower its associated crossell product ie, teddybear should also be removed automatically..plz someone guide me on this where to apply the logic

1 Answer 1


Here is a basic logic how it can be done-

You need to create an observer on remove item from cart event.

then in this observer you need to get all existing cart items and associated cross-sell products of that item and them compare them.

For matched products, you need to remove them from cart too.

I hope you know already how to create observer.

Check below link for event observer on cart item remove-

which observer to call while removing item from cart and empty cart?

  • okay sure i wil check it
    – Amy
    Oct 25, 2018 at 12:40
  • ok ..please comment if you need help. Oct 25, 2018 at 12:43

Your Answer

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

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