Try the following way:
app/code/SR/MagentoCommunity/etc/di.xml
<?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\CatalogInventory\Model\StockStateProvider">
<plugin name="sr_custom_backorders"
type="SR\MagentoCommunity\Plugin\CatalogInventory\Model\StockStateProvider" sortOrder="1"/>
</type>
</config>
Suppose you custom option Allow Pre-Order value 5.
app/code/SR/MagentoCommunity/Plugin/CatalogInventory/Model/StockStateProvider.php
<?php
namespace SR\MagentoCommunity\Plugin\CatalogInventory\Model;
use Magento\CatalogInventory\Api\Data\StockItemInterface;
class StockStateProvider
{
/**
* @param \Magento\CatalogInventory\Model\StockStateProvider $subject
* @param $result
* @param StockItemInterface $stockItem
* @param $qty
* @return bool
*/
public function afterCheckQty(
\Magento\CatalogInventory\Model\StockStateProvider $subject,
$result,
StockItemInterface $stockItem,
$qty
) {
if (!$result) {
if ($stockItem->getQty() - $stockItem->getMinQty() - $qty < 0) {
switch ($stockItem->getBackorders()) {
case \Magento\CatalogInventory\Model\Stock::BACKORDERS_YES_NONOTIFY:
case \Magento\CatalogInventory\Model\Stock::BACKORDERS_YES_NOTIFY:
case 5:
return true;
default:
return false;
}
}
}
return $result;
}
}
[Update]
Using around plugin:
app/code/SR/MagentoCommunity/Plugin/CatalogInventory/Model/StockStateProvider.php
<?php
namespace SR\MagentoCommunity\Plugin\CatalogInventory\Model;
use Magento\CatalogInventory\Api\Data\StockItemInterface;
class StockStateProvider
{
/**
* @param \Magento\CatalogInventory\Model\StockStateProvider $subject
* @param \Closure $proceed
* @param StockItemInterface $stockItem
* @param $qty
* @return bool|mixed
*/
public function aroundCheckQty(
\Magento\CatalogInventory\Model\StockStateProvider $subject,
\Closure $proceed,
StockItemInterface $stockItem,
$qty
) {
$result = $proceed($stockItem, $qty);
if (!$result) {
if ($stockItem->getQty() - $stockItem->getMinQty() - $qty < 0) {
switch ($stockItem->getBackorders()) {
case \Magento\CatalogInventory\Model\Stock::BACKORDERS_YES_NONOTIFY:
case \Magento\CatalogInventory\Model\Stock::BACKORDERS_YES_NOTIFY:
case 5:
return true;
default:
return false;
}
}
}
return $result;
}
}