0

I want to know the difference between following Magento 2 events

  1)sales_quote_add_item

  2)_merge_before

  3) _merge_after

and how I can use the event in event.xml

sales_quote_add_item and _merge_before is both are same event or different

could anyone give some ideas?

2

Both are different events.

sales_quote_add_item

When item added to the cart this event triggered.

_merge_before

Event is triggered when quotes are merged. Example When guest user login if he had an item in the cart then both quotes are merged.

  • _merge_before this event not working for me.... – prabhakaran7 Aug 21 at 8:11
  • sales_quote_merge_before complete event name. – Qaisar Satti Aug 21 at 8:12
  • can i use both in same time .... – prabhakaran7 Aug 21 at 8:13
  • sales_quote_merge_before $item = $observer->getEvent()->getQuoteItem(); $product = $item->getProduct(); //null on product item.... – prabhakaran7 Aug 21 at 8:15
  • @prabhakaran7 try $item = $observer->getEvent()->getSource()->getQuoteItem(); – Qaisar Satti Aug 21 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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