I have some problem with removing product from quote.
I observe "Add to cart" with "checkout_cart_product_add_after" event and there simply do this:
$quote->removeItem($quoteItem->getEntityId())->save();
Problem is if this product is first which is added to cart. Otherwise works fine.
Scenario: I am on category page chose a product which I want to buy. I click "Add to cart". In this moment I am checking if product can be in cart or must be removed (when product must be removed is depended of some attributes on product). Let me say, that this product shouldn' be in the cart so I am trying to remove it. But I can't. But If I add exacty same product again, it will not be added (it will be removed). I know that because qty of product doesn't increase.
Am I using wrong event? Can I maybe against removing product from cart, prevent product to be added to cart? Can anybody help me with this?
Tnx