Search by

infrangible / m2-catalog-product-list-sort-stock

infrangible

Moves out-of-stock products to the end of the product lists of all categories, before the sort order chosen by the customer.

Package info

github.com/infrangible-dev/m2-catalog-product-list-sort-stock

Homepage

Type:magento2-module

pkg:composer/infrangible/m2-catalog-product-list-sort-stock

Statistics

Installs: 15

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-11-30 16:08 UTC

This package is auto-updated.

Last update: 2026-11-30 16:11:36 UTC


README

Shows out of stock products at the end of the product lists of all categories. Customers see the products they can buy first, and the out of stock products still follow at the end of the list, for example to be found and to stay visible to search engines.

How it works

Magento shows out of stock products in the product lists only if "Display Out of Stock Products" is enabled in Stores > Configuration > Catalog > Inventory > Stock Options. They are then mixed with the other products.

The module sorts by stock before the sort order that the customer has chosen (position, name, price and so on), so within the products in stock and within the out of stock products, the chosen sort order is kept. The search engine (OpenSearch or Elasticsearch) does the sorting, so out of stock products are at the end of the whole list, not of each page.

Magento itself already sorts out of stock products to the end in the search results, and in Adobe Commerce in categories with the automatic sorting "Move out of stock to bottom". The module does this in all categories.

Configuration

Stores > Configuration > Infrangible Solutions > Product List: Out of Stock Last > General > Enable (default: Yes, per store view).

Requirements

  • Magento Open Source or Adobe Commerce 2.4.6 or newer
  • The inventory modules of Magento (MSI), including Magento_InventoryElasticsearch: they add the stock to the search index
  • PHP 8.1 or newer

Installation

composer require infrangible/m2-catalog-product-list-sort-stock
bin/magento module:enable Infrangible_CatalogProductListSortStock
bin/magento setup:upgrade
bin/magento cache:flush

In production mode, also run bin/magento setup:di:compile.

License

Infrangible Product List: Out of Stock Last is licensed under the MIT License - see the LICENSE file for details.