When an item of a specific order item type is added to the cart, I want to remove any existing items from the cart, but keep the item that has just been added.

I presume CartEvents::CART_ENTITY_ADD is the only event I can do this in, but anything i try with ->emptyCart or ->removeItem removes both the existing items AND the item that has just been added, leaving the cart empty after adding the new item.

What is the correct way to do this?


Your Answer

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

Browse other questions tagged or ask your own question.