public function afterAddStockDataToCollection(
        \Magento\CatalogInventory\Model\ResourceModel\Stock\Status $subject,
        \Magento\Catalog\Model\ResourceModel\Product\Collection $result
    ) {
        /** @var \Magento\Framework\Db\Select $select */
        $select = $result->getSelect();
        $from = $select->getPart(\Magento\Framework\DB\Select::FROM);
        $join = $from['stock_status_index'];
        $cond = $join['joinCondition'];
        $stockId = $this->_manStock->getCurrentStockId();
        $fixed = str_replace('.stock_id = 1', '.stock_id = ' . $stockId, $cond);
        $join['joinCondition'] = $fixed;
        $from['stock_status_index'] = $join;
        $select->setPart('from', $from);
        return $result;
    }
public function afterAddStockDataToCollection(
        \Magento\CatalogInventory\Model\ResourceModel\Stock\Status $subject,
        \Magento\Catalog\Model\ResourceModel\Product\Collection $result
    ) {
        /** @var \Magento\Framework\Db\Select $select */
        $select = $result->getSelect();
        $from = $select->getPart(\Magento\Framework\DB\Select::FROM);
        $join = $from['stock_status_index'];
        $cond = $join['joinCondition'];
        $stockId = $this->_manStock->getCurrentStockId();
        $fixed = str_replace('.stock_id = 1', '.stock_id = ' . $stockId, $cond);
        $join['joinCondition'] = $fixed;
        $from['stock_status_index'] = $join;
        $select->setPart('from', $from);
        return $result;
    }
public function afterAddStockDataToCollection ( \ Magento \ CatalogInventory \ Model \ ResourceModel \ Stock \ Status $ subject , \ Magento \ Catalog \ Model \ ResourceModel \ Product \ Collection $ result ) { /** @var \Magento\Framework\Db\Select $select */ $ select = $ result -> getSelect ( ) ; $ from = $ select -> getPart ( \ Magento \ Framework \ DB \ Select :: FROM ) ; $ join = $ from [ 'stock_status_index' ] ; $ cond = $ join [ 'joinCondition' ] ; $ stockId = $ this -> _manStock -> getCurrentStockId ( ) ; $ fixed = str_replace ( '.stock_id = 1' , '.stock_id = ' . $ stockId , $ cond ) ; $ join [ 'joinCondition' ] = $ fixed ; $ from [ 'stock_status_index' ] = $ join ; $ select -> setPart ( 'from' , $ from ) ; return $ result ; }
Replace default stock id in the where clause by stock id corresponded with store id.

@param \Magento\CatalogInventory\Model\ResourceModel\Stock\Status $subject
@param \Magento\Catalog\Model\ResourceModel\Product\Collection $result
@return \Magento\Catalog\Model\ResourceModel\Product\Collection
Replace default stock id in the where clause by stock id corresponded with store id .