Score:1

CartEvents::CART_ENTITY_ADD vs OrderEvents::ORDER_ITEM_CREATE

cn flag

What is the actual difference between these two events?

Is it simply that OrderEvents::ORDER_ITEM_CREATE is triggered for order items added in any way (like both from front end cart and from back end admin UI), and CartEvents::CART_ENTITY_ADD is only triggered when an item is added to a cart?

I understand that order items could be things that are not purchasable entities etc so there is a difference there, but essentially OrderEvents::ORDER_ITEM_CREATE will fire anytime that artEvents::CART_ENTITY_ADD does?

Are there other important differences?

I have some code in the CartEvents::CART_ENTITY_ADD event doing a bunch of stuff and due to a new request I now need to run the code when an order item is added in the Admin UI and not just when an item is added to the cart.

Im thinking OrderEvents::ORDER_ITEM_CREATE is the correct event to traget, with some sort of condition to only fire if the order is enetered from the admin UI.

However Im now thinking that I shouldnt be using CartEvents::CART_ENTITY_ADD at all if OrderEvents::ORDER_ITEM_CREATE is fired in all cases (both when an item is added to a cart and also when added from admin UI)?

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.