Create registration.php and module.xml file for creating a module. For Collection of product generate from Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection file. We need to create a plugin for load() function. we need to set our custom condition for out of stock product to beforeLoad() function. Create a di.xml file, Path, app/code/Grazitti/OutOfStock/etc/di.xml Need to override Stock.php file from Magento\CatalogInventory\Helper\Stock class. Create Toolbar.php file, File Path, app/code/Grazitti/OutOfStock/Plugin/Product/ProductList/Toolbar.php Clear Cache and check in the front end. I hope it will work for you.

0 comment 239 views