In magento 2.4 we can not add out of stock product while placing order from admin. I have requirement that admin should be able to order from admin side even the products are out of stock. I see the backorder but I want it only for admin side.

Thanks in advance.

  • This is the M2 core bug.
    – Sohel Rana
    Nov 24 '20 at 12:13
  • Do you have any solution? Nov 24 '20 at 12:14
  • 1
    Posted, try now
    – Sohel Rana
    Nov 24 '20 at 12:17

Try the following way until M2 fixes that core bug.


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\InventorySales\Model\IsProductSalableForRequestedQtyCondition\IsSalableWithReservationsCondition">
        <plugin name="sr_disable_stock_check_for_admin"




namespace SR\Sales\Plugin\Model\InventorySales\IsProductSalableForRequestedQtyCondition;

use Magento\InventorySales\Model\IsProductSalableForRequestedQtyCondition\IsSalableWithReservationsCondition as BaseIsSalableWithReservationsCondition;
use Magento\InventorySalesApi\Api\Data\ProductSalableResultInterface;
use Magento\InventorySalesApi\Api\Data\ProductSalableResultInterfaceFactory;

class IsSalableWithReservationsCondition
     * @var ProductSalableResultInterfaceFactory
    private $productSalableResultFactory;

     * IsSalableWithReservationsCondition constructor.
     * @param ProductSalableResultInterfaceFactory $productSalableResultFactory
    public function __construct(
        ProductSalableResultInterfaceFactory $productSalableResultFactory
    ) {
        $this->productSalableResultFactory = $productSalableResultFactory;

     * @param BaseIsSalableWithReservationsCondition $subject
     * @param \Closure $proceed
     * @param string $sku
     * @param int $stockId
     * @param float $requestedQty
     * @return ProductSalableResultInterface
    public function aroundExecute(
        BaseIsSalableWithReservationsCondition $subject,
        \Closure $proceed,
        string $sku,
        int $stockId,
        float $requestedQty
    ): ProductSalableResultInterface {
        return $this->productSalableResultFactory->create(['errors' => []]);
  • Not working. While adding product it is not coming in this function. Nov 24 '20 at 12:54
  • This is the working code. Maybe you made some mistake. You need to adjust this code into a new custom module.
    – Sohel Rana
    Nov 24 '20 at 13:46
  • I added log it should generate log file, but it is not generating. Are you sure this function is running while adding product while placing order from admin ? Nov 25 '20 at 13:08
  • I tried, I created new module with same code but it is not working. My magento version is 2.4.1 Nov 26 '20 at 11:40
  • I will check with M2.4.1 CE later.
    – Sohel Rana
    Nov 26 '20 at 14:55

enter image description here

just comment this code, to make out of stock work in admin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.