Fill the form & Get Installation Support

    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


        mage Monkeys

        Let’s initiate a discussion!!

        Book a call

        Let our Magento expert connect to discuss your requirement.

          We offer Magento
          certified developers.

          Our Magento clientele
          is 500+.

          We sign NDA for the
          security of your projects.

          We’ve performed 100+
          Magento migration projects.

          Free quotation
          on your project.

          Three months warranty on
          code developed by us.