Practical WordPress guide

Show Out of Stock Products Last for WooCommerce: safe setup, failure cases, and rollback

A plain-language guide for nontechnical site owners. It separates what the parent plugin really knows from what a helper plugin should never guess.

Reviewed July 21, 2026Official-source links includedNo invented performance claims

Direct answer

Append one ordering clause at read time, only to WooCommerce's standard shop, category, and search product loops, so in-stock products list before out-of-stock products. Verify the loop before touching it. Write nothing: no product, stock value, visibility setting, category, or template changes. When the switch is off or the query is not a verified standard loop, return every clause unchanged.

Show Out of Stock Products Last for WooCommerce follows that read-only boundary. Free adds one global switch. Pro excludes up to twenty-five categories whose archives keep the native order, and can hide out-of-stock products inside the same standard loops instead of listing them last.

A clause is not a catalog rewrite

Approach What changes Main failure surface
One read-time ordering clause Only the order of standard product loops Correct loop detection and stock-state reading
Manual drag-and-drop ordering Stored product order, maintained by hand The order drifts every time stock changes
General sorting suite Multi-key rules, per-product weights, admin tables Conflicts, extra settings, wider support surface

A merchant who only wants buyable products first does not need a stored ordering system, per-product sort weights, sortable admin tables, or a multi-key sorting engine.

Public support reports show the recurring pain. One merchant reported that a once-working snippet for pushing out-of-stock products to the end of search results stopped working. Another reported trying for a long time to sort out-of-stock products last, with forum code snippets breaking the site. A third reported posts_clauses snippets failing under an Elementor products shortcode. These reports document individual incidents only. They do not establish that every snippet or sorting plugin fails.

Let WooCommerce own the stock

WooCommerce remains the sole authority for stock status, catalog visibility, and product data. The merchant manages stock in the native product editor. A display helper only reads that state while the query runs.

That rule prevents several dangerous shortcuts:

  • Do not write a product, stock value, visibility setting, category, or template.
  • Do not copy stock state into a stored option that can drift.
  • Do not scan the catalog, schedule reordering, or run background jobs.
  • Do not reorder admin lists, REST responses, feeds, widgets, page-builder loops, or custom shortcodes.
  • Do not change pagination totals or search relevance beyond the single ordering clause.

The settings write requires the exact manage_woocommerce capability and a valid nonce. A request that lacks either saves nothing, keeps the prior valid state, and makes no remote call.

WooCommerce's official product editor documentation describes the native inventory and stock-status surface. StoreFixKit adds no second stock editor.

Touch only the standard product loop

The clause belongs only where WooCommerce itself builds the loop: the shop page, product category archives, and product search results.

WordPress's posts_clauses reference documents the filter that receives the query clauses. WooCommerce's current class-wc-query.php source shows how the standard product query is assembled. A narrow helper should confirm it is inside that standard path before appending anything, and fail quietly everywhere else.

An Elementor grid or a products shortcode builds its own query. That query stays native by design. Reordering it would require a per-builder adapter, which is exactly the failure surface in the reports above.

Turn on the switch and check the order

  1. Open WooCommerce > Out of Stock Last.
  2. Turn on Show out-of-stock products last and save.
  3. Open the shop page while signed out.
  4. Open one product category archive.
  5. Confirm in-stock products lead and out-of-stock products sit at the end.
  6. Search for a product term while signed out and confirm the same ordering holds.
  7. Confirm per-page counts and pagination totals match the native catalog.
  8. Turn the switch off and confirm the native order returns immediately.

The settings screen uses labeled controls, works by keyboard at desktop and mobile widths, and announces state to screen readers.

The correct pass condition is conditional ordering. A helper that also reorders a builder grid, the admin product list, or a feed is solving a wider job with a wider support surface.

Diagnose an unchanged order

Symptom Check first Safe expected result
Shop order unchanged Saved switch, standard loop, page cache In-stock first on standard loops only
Elementor or shortcode grid unchanged Whether the query is a standard loop Builder queries stay native by design
One category keeps the native order Pro excluded-category list Excluded archives stay native; others reorder
Order reverted while Pro is unavailable Free switch state Valid Free ordering continues
Settings page missing Whether WooCommerce is active One dismissible admin notice, no fatal error
Pagination totals changed The single appended clause Totals stay native

Start with the native shop page. If the order is correct there, the clause works and the remaining surface is a non-standard loop that is intentionally untouched. Do not clear every cache or disable every plugin before identifying which query owns the order.

Add bounded exceptions, not a sorting engine

Pro can exclude at most twenty-five categories whose archives keep the native order, and can hide out-of-stock products entirely inside the same standard loops instead of listing them last. Exact category membership is decided at read time for the current archive only.

WooCommerce already offers a native setting that hides out-of-stock products from the catalog. Listing them last is the middle path: they stop crowding the front of the shop but stay reachable on their own URLs. If Pro or the license API is unavailable, the valid Free ordering continues.

Understand compatibility honestly

The ordering clause is a shared query surface. WooCommerce's standard loops run it, but a page builder, shortcode, widget, feed, or remote client does not have to.

A safe product promise is therefore:

  • standard shop, category, and search loops reorder while the switch is on;
  • every non-standard query keeps the clauses WooCommerce and WordPress built;
  • a disabled switch or malformed state returns the native order immediately;
  • no product, stock value, visibility setting, category, or template is ever written.

This is more useful than claiming the shop reorders everywhere, which cannot be proven across an open plugin ecosystem.

Test failure and rollback

Release acceptance should cover:

  1. A mixed catalog with the switch on.
  2. Switch off, malformed stored state, and uncertain queries returning every clause unchanged.
  3. Page-builder loops, custom shortcodes, widgets, admin lists, REST responses, and feeds staying native.
  4. WooCommerce missing causing no fatal error.
  5. Pro or the license API unavailable leaving Free ordering active.
  6. Update, downgrade, rollback, deactivation, and uninstall.
  7. Unchanged products, prices, stock values, categories, templates, carts, and orders.

When WooCommerce is missing or inactive, the plugin registers no settings page or query hook and shows one dismissible admin notice. There is no fatal error and no public mutation.

Because nothing is written, rollback is immediate. Turn the switch off or deactivate, and the native catalog order returns with no residue. Uninstall removes only the plugin's own settings.

Resource boundary

A read-time clause needs one owned option read per product loop and one appended ordering clause. It does not need a second query, a cron event, a custom table, a background job, JavaScript, a stylesheet, a storefront remote request, or idle work. Measure the real hosting stack before a high-traffic launch.

The plugin stores no personal data and sends no telemetry. Pro contacts the StoreFixKit license and update API only from authenticated admin requests.

Common mistakes

Pasting a tutorial snippet into functions.php

The snippet becomes code you own. It breaks quietly when themes, builders, or WooCommerce change the query.

Hiding out-of-stock products everywhere

The native hide setting removes them from the catalog entirely. Listing them last keeps the pages reachable without leading the shop.

Dragging products into order by hand

A manual order does not follow stock changes. Every restock and every sell-out breaks it again.

Reordering every product query

Admin lists, REST responses, feeds, and widgets must stay native. Wider reordering breaks integrations and exports.

Editing stock values to fix display order

A display problem is not a data problem. Stock edits corrupt reports, purchasing, and fulfillment.

Market boundary

The official WooCommerce Marketplace lists a current Sort | Hide Out of Stock offer and a current Advanced Product Sorter offer, both at $39 per year, and WordPress.org has established sorting plugins. That proves an active paid sorting category. It does not prove demand or revenue for a narrower read-time clause.

The commercial hypothesis is that some nontechnical merchants prefer one switch over owning a snippet or a sorting suite. Measure StoreFixKit installs, setup completion, verified reorders, trial starts, paid conversions, refunds, renewals, and support load. A competitor price or install count is not StoreFixKit traction.

FAQ

How do I move out-of-stock products to the end of my WooCommerce shop?

Turn on one switch that appends a read-time ordering clause to the standard shop, category, and search loops. In-stock products list first; nothing is written to products or stock.

Why is my Elementor grid or products shortcode unchanged?

Those queries are not WooCommerce's standard product loop. They stay native by design; reordering them would need builder-specific adapters.

What happens when the switch is off or the plugin is deactivated?

The clause disappears immediately and the native catalog order returns with no residue. If only Pro or licensing is unavailable, the valid Free ordering continues.

Focused plugin

Use the one-job implementation.

Move out-of-stock products to the end of WooCommerce's standard shop, category, and product-search lists through one read-time ordering clause, without editing stock, products, templates, pagination, or non-standard queries.