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.
You can get a list of events from below blogs,
You can use sales_order_payment_save_after event for your case.
You can get a list of events from below blogs,
You can use sales_order_payment_save_after event for your case.
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!
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
Try with below solutions,
$payment = $observer->getDataByKey('payment'); $order = $payment->getOrder(); $order->getId() $order->getIncrementId();
Hi,
Did you tried this event "sales_order_place_after".
$order = $observer->getEvent()->getOrder();