Powered by Adobe Commerce 2.4.9

icon_240x240.png

Out Of Stock At Last

PRODUCT:
0
TOTAL:

Trader Information

Back to top

Overview

Back to top

When shoppers browse a Magento 2 category or search for a product, seeing out-of-stock items scattered throughout the listing creates a frustrating experience — customers click on products only to discover they cannot be purchased. The Mage2Expert Out of Stock at Last extension solves this problem automatically: it pushes every out-of-stock product to the bottom of all category listing pages and search result pages, so in-stock items always appear first. The sorting is applied transparently alongside any active sort order (price, name, newest, etc.) — in-stock products are sorted among themselves, and out-of-stock products are sorted among themselves, but the two groups are always kept apart. No template changes, no theme modifications, and no core code changes are required.

Features

  • Automatically pushes out-of-stock products to the bottom of every category listing page and search result page — in-stock products always appear first, regardless of the active sort order
  • Category page toggle — independently enable or disable out-of-stock sorting on category listing pages (catalog_category_view) from the admin configuration
  • Search result page toggle — independently enable or disable out-of-stock sorting on catalog search results (catalogsearch_result_index and advanced search results)
  • Elasticsearch & OpenSearch support — adds a dedicated integer field (out_of_stock_at_last) to the catalog search index; in-stock products receive value 1, out-of-stock products receive 0, ensuring correct sort order in both layered navigation and full-text search results
  • MSI (Multi-Source Inventory) ready — reads the aggregate salable quantity across all assigned inventory sources; a product is treated as out-of-stock only when every source reports zero or negative salable qty
  • Configurable product support — a configurable product is treated as in-stock if at least one of its child simple products has a positive salable qty; it is only sorted to the bottom when all children are out of stock
  • Master enable / disable switch — deactivate the entire module from Stores > Configuration without uninstalling it; index data and configuration are preserved
  • Works only when out-of-stock products are visible — requires Display Out of Stock Products to be set to Yes in Stores > Configuration > Catalog > Inventory > Stock Options; if out-of-stock products are hidden, this module has no visible effect
  • Zero core overrides — implemented entirely via Magento 2 plugins (interceptors), virtual types, and dependency injection; upgrade-safe and compatible with any other extension
  • Compatible with PHP 8.1, 8.2, 8.3, and 8.4
  • Compatible with all standard Magento 2 frontend themes including Luma and Hyvä
  • Follows Magento Coding Standards (PHPCS / MECS) and PSR-4 autoloading

Who Needs This Extension?

Any Magento 2 store that displays out-of-stock products in the catalog can benefit from this extension. Stores with large catalogs — fashion, electronics, furniture, auto parts — regularly have a proportion of their SKUs temporarily or permanently out of stock. Without this extension, those out-of-stock items occupy prominent positions in listings based on price, name, or relevance score, causing shoppers to click through to unavailable products and increasing bounce rates. The Mage2Expert Out of Stock at Last extension solves this without requiring store owners to manually re-sort categories or write custom code — once installed and configured, the sorting happens automatically for every category and search query.

How It Works

During Elasticsearch / OpenSearch indexing, the module's batch data mapper plugin sets the value of a custom field out_of_stock_at_last on every product document: 1 for in-stock products and 0 for out-of-stock products. At query time, two plugin chains inject the sort order:

  • Collection plugin — hooks into Magento\Catalog\Model\ResourceModel\Product\Collection::setOrder() and addOrder() to prepend ORDER BY out_of_stock_at_last DESC as the primary sort criterion before any shopper-selected or default sort is applied. A per-collection flag prevents duplicate ORDER BY clauses.
  • SearchResultApplier plugin — for search result pages, where the product collection is populated from Elasticsearch hit IDs rather than a direct SQL query, the plugin re-orders the hit list by the out_of_stock_at_last field value before the IDs are loaded into the collection.

Both plugins check the admin configuration before acting, so disabling the module or toggling a specific page type takes effect immediately after flushing the cache — no reindexing required.

Prerequisites

  • Elasticsearch 7.x or OpenSearch 1.x / 2.x must be configured as the Magento catalog search engine (Stores > Configuration > Catalog > Catalog Search). MySQL search is not supported.
  • Display Out of Stock Products must be set to Yes in Stores > Configuration > Catalog > Inventory > Stock Options. If this setting is disabled, out-of-stock products are hidden from the frontend and the sorting cannot be observed.
  • After installation, run php bin/magento indexer:reindex catalogsearch_fulltext to add the out_of_stock_at_last field to all existing product documents.

Benefits

  • Better shopper experience — customers always see purchasable products first; they never have to scroll past unavailable items before finding something they can buy
  • Reduced bounce rate — fewer clicks on unavailable products means fewer disappointed shoppers leaving the site
  • No manual category management — stock status changes are picked up automatically during reindexing; no need to manually re-order category positions when products go in or out of stock
  • Preserves existing sort logic — the active sort order (price, name, newest, relevance) is respected within the in-stock and out-of-stock groups; the extension only separates the two groups, it does not override the shopper's sort preference
  • Granular page-type control — if category sorting works well but search results need different treatment (or vice versa), each can be toggled independently
  • Conflict-free — the plugin-only approach means no core file modifications, reducing upgrade risk and third-party extension conflicts to a minimum

Configuration

Navigate to Stores > Configuration > Magento Expert > Out Of Stock At Last > General Settings to manage all module options:

  • Enable Module — master switch; set to No to disable all out-of-stock sorting without uninstalling the module
  • Apply on Category Pages — push out-of-stock products to the bottom on category listing pages; shown only when Enable Module is Yes
  • Apply on Search Result Pages — push out-of-stock products to the bottom on catalog search result pages; shown only when Enable Module is Yes

Technical Specifications

Back to top

Seller profile

Sukumar Gorai

Seller contact

E-mail

Current Version

1.0.0

Adobe Commerce platform compatibility

Adobe Commerce (cloud): 2.4 (current)

Adobe Commerce (on-prem): 2.4 (current)

Magento Open Source: 2.4 (current)

Type

Stable Build

Updated

01 July, 2026

Categories

Extensions, Site Optimization

Documentation

User Guides

License Type

Open Software License 3.0 (OSL-3.0)

Policy

Privacy Policy

Quality Report

Back to top

Installation & Varnish Tests

Passed

Coding Standard

Passed

Plagiarism Check

Passed

Malware Check

Passed

Marketing Review

Passed

Manual Testing

Passed

All tests were conducted on the latest versions of Adobe Commerce that existed for the compatible release lines at the moment of the extension submission. Latest versions of all other software were used, as applicable.

Release Notes

Back to top

1.0.0:

  • Compatible with Adobe Commerce (cloud) : 2.4
  • Compatible with Adobe Commerce (on-prem) : 2.4
  • Compatible with Magento Open Source : 2.4
  • Stability: Stable Build
  • Description:

    Initial release — custom out_of_stock_at_last Elasticsearch / OpenSearch field; collection and SearchResultApplier plugins for category and search page sorting; MSI and configurable product support; per-page-type admin toggles; master enable/disable switch; ACL resource; zero core code modifications; PHP 8.1–8.4 compatible.

Support

Back to top

The best place to start if you need help with a specific extension is to contact the developer. All Adobe Commerce developers have both a contact email and a support email listed.

Contact Vendor

Q & A

Back to top

Reviews

Back to top