You need to create Vendor_Module and do the following:
Override the Grid.php like below:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Sales\Block\Adminhtml\Order\Create\Search\Grid" type="Vendor\Module\Block\Adminhtml\Order\Create\Search\Grid" />
</config>
Add the below code to your Grid.php in the below location:
app/code/Vendor/Module/Block/Adminhtml/Order/Create/Search/Grid.php
Code for Grid.php:
<?php
namespace Vendor\Module\Block\Adminhtml\Order\Create\Search;
class Grid extends \Magento\Sales\Block\Adminhtml\Order\Create\Search\Grid
{
protected $_salesConfig;
protected $_sessionQuote;
protected $_catalogConfig;
protected $_productFactory;
protected function _prepareColumns()
{
$this->addColumn(
'available_qty',
[
'filter' => false,
'sortable' => false,
'header' => __('Available Quantity'),
'renderer' => \Vendor\Module\Block\Adminhtml\Order\Create\Search\Grid\Renderer\Availableqty::class,
'name' => 'available_qty',
'inline_css' => 'available_qty',
'type' => 'input',
'validate_class' => 'validate-number',
'index' => 'available_qty',
'sortOrder' => 500
]
);
return parent::_prepareColumns();
}
}
Create one more class Availableqty.php under below location:
app/code/Vendor/Module/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Availableqty.php
and add the below code:
<?php
namespace Vendor\Module\Block\Adminhtml\Order\Create\Search\Grid\Renderer;
class Availableqty extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text
{
private $stockItem;
public function __construct(\Magento\CatalogInventory\Api\StockStateInterface $stockItem)
{
$this->stockItem = $stockItem;
}
public function render(\Magento\Framework\DataObject $row)
{
return $this->stockItem->getStockQty($row->getId(), $row->getStore()->getWebsiteId());
}
}
Run setup:upgrade and di:compile and test.