- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need the item_id while order is placed . i get all the information except item_id , while using event "sales_order_save_after" . while search in net i found event "checkout_onepage_controller_success_action" but some say this event call only for front end orders and it may not call if payment gateway redirects back to the merchant website. I need event call after both order and order_item saved in table.
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can get a list of events from below blogs,
You can use sales_order_payment_save_after event for your case.
Magento 2 Blogs/Tutorial
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can get a list of events from below blogs,
You can use sales_order_payment_save_after event for your case.
Magento 2 Blogs/Tutorial
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: event after both order and order_item saved in table.
Hi Sundar,
The sales_order_place_after event will help you to get both the order and item information. Please try this event.
Hope it helps!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: event after both order and order_item saved in table.
Did you provide some example code .
i use following code to get order id
$order = $observer->getEvent()->getOrder();
$order_id = $order->getId();
but not working for sales_order_payment_save_after event
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: event after both order and order_item saved in table.
Try with below solutions,
$payment = $observer->getDataByKey('payment'); $order = $payment->getOrder(); $order->getId() $order->getIncrementId();
Magento 2 Blogs/Tutorial
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: event after both order and order_item saved in table.
Hi,
Did you tried this event "sales_order_place_after".
$order = $observer->getEvent()->getOrder();