Item status in sales order view not showing backordered after invoice is created
-
15-04-2021 - |
Question
When we receive an order containing an out of stock item (that's allowed to be backordered) it nicely shows "Backordered" at 'Item status' in the backend sales order view.
magento item status = backordered if the invoice is not yet created! When the invoice is created, the item status automatically changes to invoiced, see image.
magento item status = invoiced, even though still in backorder. This seems not logical to me and is definitely unwanted behavior. Even after the invoice has been created, I'd still like/need to know what products are in backorder.
Any idea how we can keep the message "backordered" on the order view?
No correct solution
OTHER TIPS
You can use event sales_order_save_after, and inside the Observer put logic something like:
$oldstatus=$order->getOrigData('status');
$newstatus=$order->getData('status');
if($oldstatus == 'backordered' && $oldstatus != $newstatus) { //this checks if order was backordered and if the status is changed, it'll entered inside condition
$order->setStatus($oldstatus); //sets back the status to old status 'backordered'
}