AddSortByStockQtyToCollection
Magento\InventoryCatalog\Model\ResourceModel\AddSortByStockQtyToCollection
What it does
This class adds sorting capability by stock quantity to Magento product collections.
Developers use this when they need to display products ordered by their available stock levels, such as showing products with highest stock first or prioritizing low-stock items.
It joins the inventory index table to the product collection and applies the specified sort direction.
Public Methods
- execute()