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?

1 Answer 1

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.

9
  • _merge_before this event not working for me.... Aug 21, 2019 at 8:11
  • sales_quote_merge_before complete event name. Aug 21, 2019 at 8:12
  • can i use both in same time .... Aug 21, 2019 at 8:13
  • sales_quote_merge_before $item = $observer->getEvent()->getQuoteItem(); $product = $item->getProduct(); //null on product item.... Aug 21, 2019 at 8:15
  • @prabhakaran7 try $item = $observer->getEvent()->getSource()->getQuoteItem(); Aug 21, 2019 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.