Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To create a separate WooCommerce page for sold-out items, filter products whose stock status is outofstock. For most stores, add a Product Collection block, open its custom query settings, set Stock Status to Out of stock, and publish the page at the URL you want. If you need custom markup or business logic, use WooCommerce’s wc_get_products() function with stock_status => outofstock rather than a custom database query.

In this context, “sold out” means currently unavailable according to WooCommerce inventory status. It does not automatically mean discontinued, permanently unavailable, or never coming back.

What WooCommerce considers “sold out”

WooCommerce stores inventory state as a stock status. The value that represents an unavailable product is outofstock. That is different from the sold_individually setting, which limits a customer to one unit per order but does not mean the product has no stock.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A sold-out archive therefore answers the question “Which catalog items are currently marked out of stock?” It is not, without additional rules, a list of discontinued products, products that will never return, or products that have reached a historical sales milestone.

Before publishing the page, check how your store models inventory. A simple product has its own stock status; variable products can also have stock states on individual variations. Catalog-visibility settings and the way your theme handles unavailable items can affect what shoppers see. Test representative simple and variable products rather than assuming every inventory setup behaves identically.

Choose the implementation that fits your site

Method Best for Control Important limitation
Product Collection block Block themes and stores that need a maintained page without custom code Built-in product layout, ordering, products per page, and stock filtering Editor labels and available controls can vary by WooCommerce release and active theme
wc_get_products() Classic themes, custom templates, shortcodes, or bespoke business rules Full PHP control over query arguments and rendered HTML You must build markup, pagination, styling, and accessibility details
Store API product collection Client-rendered interfaces or JavaScript applications already using the Store API Client-side loading, filtering, sorting, and interactive behavior The collection exposes published products only; your application must handle loading, errors, and pagination

Method 1: Build the page with the Product Collection block

The Product Collection block is the lowest-code option. WooCommerce uses it in product templates, and you can also place it on an ordinary page or another template to make a dedicated archive.

1. Create or open the destination page

  1. In WordPress, open Pages and create a new page, or edit the page that should contain the archive.
  2. Give it a clear title such as “Sold Out” or “Currently Unavailable.” The title is for shoppers; the filtering is what determines the products shown.
  3. Place the cursor where the listing should appear and add a Product Collection block.

2. Switch the collection to a custom query

  1. Select the Product Collection block and open its block settings.
  2. Choose the option for a custom query. The exact wording can differ between WooCommerce versions and themes.
  3. Find the query’s Stock Status control and select Out of stock.
  4. Set ordering and products per page to match the page’s purpose. A recently unavailable-first order can be useful for restock communication; a name order is easier for a long reference list.

3. Check the surrounding template

Make sure the page template supplies the site header, navigation, content width, and footer you expect. A block can be technically correct while still looking like a separate, unbranded page if the wrong template is selected.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Preview and publish

  1. Preview the page as a shopper who is not logged in.
  2. Confirm that every displayed item is currently out of stock and that an in-stock control product does not appear.
  3. Open at least one product from the listing and verify that its product page communicates the same availability state.
  4. Publish the page and add it to the navigation, a catalog-information section, or a restock-information flow as appropriate.

This approach does not require a third-party plugin. It uses WooCommerce’s built-in collection and query controls, although the precise editor interface is release- and theme-dependent.

Method 2: Query the archive with PHP

Use PHP when the archive needs a custom card design, a special heading, conditional messaging, integration with an existing template, or rules that the block editor cannot express. WooCommerce’s supported product query function is wc_get_products().

Basic out-of-stock query

<?php
$products = wc_get_products(
    array(
        'status'       => 'publish',
        'stock_status' => 'outofstock',
        'limit'        => 12,
        'page'         => 1,
    )
);
?>

status => publish keeps the archive focused on public products. stock_status => outofstock is the key filter. The limit and page values make the query bounded; do not retrieve an unbounded catalog for a production page.

Render product objects through WooCommerce methods

The function returns product objects. Use their methods and your theme’s normal escaping conventions instead of reading product tables directly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<?php if ( $products ) : ?>
    <ul class="sold-out-products">
        <?php foreach ( $products as $product ) : ?>
            <li class="sold-out-products__item">
                <a href="<?php echo esc_url( $product->get_permalink() ); ?>">
                    <?php echo $product->get_image( 'woocommerce_thumbnail' ); ?>
                    <span class="sold-out-products__name">
                        <?php echo esc_html( $product->get_name() ); ?>
                    </span>
                </a>
                <span class="sold-out-products__status">Sold out</span>
            </li>
        <?php endforeach; ?>
    </ul>
<?php else : ?>
    <p>There are no sold-out products to display right now.</p>
<?php endif; ?>

Place this logic in a child-theme template, a carefully scoped custom plugin, or another deployment location that will not be overwritten by theme updates. Match the surrounding theme’s HTML classes and grid structure so keyboard navigation, responsive behavior, and image sizing remain consistent.

Add pagination instead of loading everything

For a catalog with more than one page of results, increase the page number from the current request and render navigation links. Keep the limit stable, preserve the archive URL, and validate the requested page so a visitor cannot force an excessive query. The exact pagination code depends on whether the listing is a page template, shortcode, or custom endpoint, but the product query should continue to use a finite limit and explicit page.

Why not use a custom WP_Query or SQL?

WooCommerce developer documentation warns: “Building custom WP_Queries or database queries is likely to break your code in future versions of WooCommerce as data moves towards custom tables for better performance.” The product query abstraction is the safer forward-compatible boundary. It also lets WooCommerce adapt product retrieval as its storage implementation changes.

Method 3: Use the Store API for a client-rendered archive

If the page already renders products in JavaScript, use the Store API products collection and pass stock_status as an array containing outofstock. The collection also supports catalog-visibility filtering and other collection parameters.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Request and render flow

  1. Request a product collection from your site’s Store API.
  2. Set the stock-status filter to an array with the value outofstock.
  3. Apply the catalog-visibility filter your storefront requires.
  4. Request a finite page size and a specific page rather than downloading the whole catalog.
  5. Render the returned product data into links, images, names, prices where appropriate, and an unmistakable sold-out label.
  6. Handle loading, empty, error, and retry states in the interface.

Only published products are accessible through this collection endpoint. Draft, private, or otherwise non-published products will not become visible merely because their stock status is out of stock.

When this method is worth the extra complexity

A client-rendered archive makes sense when filtering, sorting, infinite scrolling, or partial-page updates are already part of the storefront architecture. For a normal WordPress page that only needs a stable list, the Product Collection block is easier to maintain and the PHP abstraction is simpler to debug.

Make the archive useful to shoppers

Label availability clearly

Use a visible “Sold out” or “Out of stock” label on every card. Do not rely only on muted colors, a disabled button, or an image treatment. If a product can accept back-in-stock notifications, link to that action; otherwise, link to the product page so shoppers can read specifications and alternatives.

Decide whether prices and purchase controls belong

Prices can help shoppers recognize products, but a sold-out archive should not imply that checkout is available. Hide or disable purchase controls consistently with the product page. If your store accepts backorders, verify whether those products should remain in this archive: the business meaning of “sold out” may differ from WooCommerce’s current stock-status value.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use an empty-state message

When every product is in stock, the query correctly returns no items. Show a useful message such as “No products are currently sold out” and provide a link back to the main catalog. Avoid leaving a blank content area that looks like a loading failure.

Keep the page crawlable and accessible

  • Give the page one descriptive heading and a stable, human-readable URL.
  • Use real links for product cards, visible keyboard focus, and meaningful alternative text for product images.
  • Do not hide the entire archive from assistive technology when only a status badge is decorative.
  • If the listing is paginated, expose understandable next and previous controls and preserve the current page in the URL.

Inventory and variation checks before launch

Run these checks with products that represent your catalog:

  • A simple product manually set to out of stock appears.
  • A simple product with available stock does not appear.
  • A variable product with unavailable variations behaves as your store intends; confirm whether the parent product’s status and each variation’s status produce the result you want.
  • A published product appears, while a draft or private product does not.
  • Products affected by your catalog-visibility settings follow the visibility rules you expect.
  • The archive behaves correctly when stock is changed, cache is cleared or expired, and the page is viewed while logged out.

These checks matter because stock synchronization, variation rules, caching, and catalog settings can make a technically correct filter look incomplete for a particular store.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common problems

The page is empty even though products look sold out

Open the product editor and confirm the stock status is actually out of stock, not merely configured with a low quantity, backorder behavior, or a disabled purchase button. Then check that the product is published and that catalog-visibility settings do not exclude it. Clear page and object caches after changing inventory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In-stock products appear in the archive

Inspect the collection’s custom query or PHP arguments. The filter must be the stock-status value outofstock; a product-limit setting alone does not filter availability. In custom code, make sure another query is not replacing the filtered product array before rendering.

The block controls do not match these labels

WooCommerce and themes can change editor wording and control placement. Select the Product Collection block, inspect its query settings, and look for a stock-status filter or equivalent custom-query control. If the active theme does not expose the expected controls, use a PHP template or the Store API instead.

The custom PHP list breaks after an update

Replace direct SQL and general-purpose queries against WooCommerce internals with wc_get_products(). Keep the query arguments explicit, use product methods for output, and test the archive after WooCommerce updates.

The archive is slow

Reduce the products-per-page limit, add pagination, avoid loading full product objects when a smaller response is sufficient, and review page or object caching. Do not solve a slow archive by switching to direct database access; that trades a short-term query gain for compatibility risk.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended decision

Start with a Product Collection block when your theme supports it and the archive needs ordinary filtering and layout controls. Choose wc_get_products() when the page is part of a custom PHP template or requires custom markup and rules. Choose the Store API only when client-side rendering is already justified by the rest of the storefront. Whichever route you use, define “sold out” as the current outofstock state, test simple and variable products, and provide a clear empty state and status label.

Frequently Asked Questions

Does an out-of-stock archive prove that products are discontinued?

No. It identifies products currently marked outofstock. Discontinued status requires a separate catalog rule or editorial decision.

Can I create this page without installing a plugin?

Yes. WooCommerce’s Product Collection block is built in, and custom implementations can use the supported wc_get_products() function or Store API.

Why should I avoid a direct SQL query for sold-out products?

WooCommerce advises against custom database queries because product data is moving toward custom tables. The supported product query abstraction is more resilient to those storage changes.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.