Web Analytics

Fill the form & Get Installation Support





    How to display out of stock product at last on catalog page in Magento 2?

    Check below step If you want to display out of stock products at last on product listing page in Magento 2.

    You need to develop a custom extension (Here, I’m assuming that you know how to create custom extension in Magento 2).

    We need to use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection for product collection.

    1. Create app/code/Magemonkeys/OutOfStockAtLast/etc/di.xml and add below code.

    2. Create app/code/Magemonkeys/OutOfStockAtLast/Plugin/Product/ProductList/Toolbar.php and add below code.

    There you go. I hope following above steps will let you display out of stock product at last on catalog page in Magento 2.

    Happy coding!

    Fill the below form if you have any Magento programming need.





      Recent Articles

      Author Info

      Author Image

      Magento Certified Developer

      Hire V. Brahmbhatt

      Get a Free Quote





        Connect With Us