Score:1

Commerce - empty cart of EXISTING items when adding new item of specific order item type

cn flag

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?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.