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 -…

how to pass the upload file values to magento 2 uploader?

I have a custom checkout, I have created a custom image up-loader in my checkout file in shipping section. I want to pass the upload file to controller using ajax. <script type=”text/javascript”> function uploadStateIdCopy( ) { var formData = new FormData(); // add assoc key values, this will be posts values formData.append(“file”, jQuery(‘#stateidcopy_file’)[0].files[0]); formData.append(“upload_file”, true);…

How Shopping Cart, Order Summary get quantity value?

I found this page vendor/magento/module-checkout/view/frontend/web/ template/summary/item/details.html <!– /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ –> <!– ko foreach: getRegion(‘before_details’) –> <!– ko template: getTemplate() –><!– /ko –> <!– /ko –> <div class=”product-item-details”> <div class=”product-item-inner”> <div class=”product-item-name-block”> <strong class=”product-item-name” data-bind=”html: $parent.name”></strong> <div class=”details-qty”> <span class=”label”><!– ko i18n:…