magento , the qty of products goes into minus on backorder

I’m trying to put qty to 0 if qty < 0, but it’s not working for me i all time have qty on minus my code don’t working for me public function salesOrderSaveAfter($event) { $order = $event->getOrder(); $orderIncrementId = $order->getIncrementId(); foreach ($order->getAllVisibleItems() as $item) { $oldQty = (int)$item->getProduct()->getStockItem()->getQty(); $qtyOrdered = (int)$item->getQtyOrdered(); $differenceQty = $oldQty -…

magento , the qty of products goes into minus on backorder

I’m trying to put qty to 0 if qty < 0, but it’s not working for me i all time have qty on minus my code don’t working for me public function salesOrderSaveAfter($event) { $order = $event->getOrder(); $orderIncrementId = $order->getIncrementId(); foreach ($order->getAllVisibleItems() as $item) { $oldQty = (int)$item->getProduct()->getStockItem()->getQty(); $qtyOrdered = (int)$item->getQtyOrdered(); $differenceQty = $oldQty -…

magento , the qty of products goes into minus on backorder

I’m trying to put qty to 0 if qty < 0, but it’s not working for me i all time have qty on minus my code don’t working for me public function salesOrderSaveAfter($event) { $order = $event->getOrder(); $orderIncrementId = $order->getIncrementId(); foreach ($order->getAllVisibleItems() as $item) { $oldQty = (int)$item->getProduct()->getStockItem()->getQty(); $qtyOrdered = (int)$item->getQtyOrdered(); $differenceQty = $oldQty -…

magento , the qty of products goes into minus on backorder

I’m trying to put qty to 0 if qty < 0, but it’s not working for me i all time have qty on minus my code don’t working for me public function salesOrderSaveAfter($event) { $order = $event->getOrder(); $orderIncrementId = $order->getIncrementId(); foreach ($order->getAllVisibleItems() as $item) { $oldQty = (int)$item->getProduct()->getStockItem()->getQty(); $qtyOrdered = (int)$item->getQtyOrdered(); $differenceQty = $oldQty -…