Blog

Hide Out of Stock Products in WooCommerce Without Losing SEO

WooCommerce hide out of stock products: a sold-out product hidden from the shop but still live and indexable

To hide out of stock products in WooCommerce, go to WooCommerce > Settings > Products > Inventory, tick Hide out of stock items from the catalog and save. Sold-out products drop out of the shop, category pages, product search and related products, and sold-out variations drop out of the dropdowns on the product page.

What the setting doesn’t do is remove the product page. We tested it in WooCommerce 11.2.1 on a block theme store: the sold-out product’s address still loaded with a normal 200 status, had no noindex tag and stayed in the sitemap, so nothing tells Google to drop it. A product block on the home page kept showing a sold-out chair, and a category with only sold-out products turned into an empty page.

This guide covers the setting, what our test showed place by place, and the decision most guides skip: whether to keep, noindex or redirect each sold-out page, with a short snippet or with a plugin.

How to hide out of stock products in WooCommerce

  1. Go to WooCommerce > Settings > Products and click Inventory at the top.
  2. Find Out of stock visibility and tick Hide out of stock items from the catalog.
  3. Click Save changes.
Hide out of stock items from the catalog ticked under Out of stock visibility in WooCommerce inventory settings

The setting reads each product’s stock status, so it works whether or not you track quantities. With Manage stock on, a product turns Out of stock when its quantity reaches the Out of stock threshold (0 here). Without it, the status is whatever you choose in the product’s Stock status field. Products On backorder count as in stock and stay visible. When you restock a hidden product, it comes back in the shop on its own. WooCommerce’s settings docs describe it in one line: it hides out of stock items “from the store catalog/customer view”.

What the setting hides, and what it doesn’t

In the Larch Home demo store (a block theme), we set 2 products to out of stock: the $4.50 Glass Milk Bottle and the $289 Leather Sling Chair, the only product in the Furniture category. We also sold out one variation of the Ribbed Ceramic Vase (Large, Sand). Then we loaded every place they could appear as a logged-out shopper, with the setting off and on.

WhereSetting offSetting on
Shop pageListedHidden
Category pagesListedHidden (Furniture became empty)
Product searchFoundHidden
Related productsNot shown (the block’s own filter)Not shown
Product block on the home pageShownStill shown
Sold-out variationCan be chosen, says “Out of stock”Left out of the dropdown
Product pageLoads, says “Out of stock”Loads, says “Out of stock”
Robots meta tagIndexableIndexable (no noindex)
WordPress XML sitemapListedListed

So the setting changes what shoppers can browse to, not what exists. Three of these results need a closer look.

Product blocks in your pages and templates can ignore the setting

In a block theme, the shop, category and search templates follow the setting. A Product Collection block that you placed on a page, such as “Bestsellers” or “New arrivals” on the home page, doesn’t: it uses its own Stock Status filter, saved in the block. Ours included Out of stock, so the sold-out chair stayed in Bestsellers after we ticked the box.

Sold-out Leather Sling Chair still listed in the home page Bestsellers block with the hide setting on
The chair is out of stock and hidden from the shop, but the home page block still lists it.

Which blocks do this depends on when they were added. In WooCommerce 11.2.1 a newly inserted Product Collection block leaves Out of stock out of its Stock Status filter when the hide setting is on, so blocks you add after ticking the box hide sold-out products, and blocks added before it keep showing them.

Our Bestsellers block isn’t on a Page: it sits in the theme’s Front Page template, which is where most block themes put home page product blocks. To fix it:

  1. Go to Appearance > Editor > Templates and open Front Page (or Home, depending on your theme).
  2. Select the Product Collection block.
  3. In the block settings, open Filters > Stock Status and remove Out of stock.
  4. Save.

Do the same for every page, template and template part with a Product Collection block. The related products block in WooCommerce’s own block templates already shows only in-stock and backorder products, with or without the setting.

A category with only sold-out products becomes an empty page

Furniture had a single product. Once it sold out and was hidden, the Furniture page still loaded and still sat in the menu, but showed “No results found”. It also answered with a 200 status, had no noindex tag and stayed in the category sitemap, so it stays indexable. Shoppers who click it hit a dead end, and Google’s docs say a page whose content suggests “an empty page or an error message” shows up in Search Console as a soft 404.

Furniture category page showing No results found after its only product sold out and was hidden

Neither WooCommerce nor Store SEO Toolkit adds noindex to an empty category. Take a category like this out of the menu until it’s restocked, give it a short intro text that says when stock is due and links to related categories, or noindex it for the time being with your SEO plugin. You can also show its sold-out products last instead of hiding them.

Sold-out variations disappear from the dropdown

With the setting on, WooCommerce leaves sold-out variations out of the variation data on the product page. On the Ribbed Ceramic Vase, choosing Large left only Chalk in the Finish dropdown; Sand was gone. With the setting off, shoppers could choose Large and Sand and saw “$50.00, Out of stock” with the Add to cart button disabled.

With the standard add-to-cart form (the one our theme’s product template uses), this only works when the variations load with the page, which WooCommerce does for products with up to 30 variations. Above that, the product page asks the store for each combination as the shopper picks it, and that request doesn’t check the setting: shoppers can still pick a sold-out combination and see “Out of stock” with the Add to cart button disabled, the same as with the setting off. When every variation sells out, the whole product is out of stock and hidden like any other.

Hidden products still load, and stay indexable

Hiding doesn’t unpublish anything. The sold-out Glass Milk Bottle’s page answered with a normal 200 status, showed its price and “Out of stock” without an Add to cart button, had no noindex tag and stayed in the product sitemap (/wp-sitemap-posts-product-1.xml). Anyone with the link, from Google, an old email, a bookmark or a Pinterest pin, still lands on it.

Sold-out Glass Milk Bottle product page still loading with Out of stock below the description
Hidden from the shop, but the page still loads for anyone with the link.

Often that’s what you want. WooCommerce marks the page’s product structured data as OutOfStock, so Google can show the result as out of stock (our guide to WooCommerce rich snippets shows that markup field by field). But a page that stays sold out for long may not keep its place. Google’s John Mueller has said that out-of-stock pages “generally tend to end up as soft 404 pages” and then disappear from search, and later that there’s no fixed timeframe for it. Hiding the product also removes most internal links to it, so Google mostly reaches it through the sitemap and outside links.

So once the box is ticked, decide what each sold-out page should do.

Keep, noindex or redirect sold-out product pages?

One question decides it: is the product coming back?

Decision chart for sold-out product pages: keep indexed if back within weeks, noindex after a set time if gone for months, 301 redirect if discontinued

Coming back soon: keep the page indexed

For a restock in days or weeks, leave the page alone. Its ranking, reviews and links stay, and the structured data already says OutOfStock. If you know when, say it in the short description (“Back in about 3 weeks”) and point to an alternative. If you use WooCommerce’s Back in Stock Notifications (an experimental feature, off by default), note that its settings page warns that customers can’t sign up for back-in-stock emails while the hide setting is on. Don’t noindex these pages: Google drops them, and they only come back after Google crawls them again, which can take a while.

Gone for months, or not sure: noindex after a set time

Seasonal products, small production runs and items your supplier can’t promise fit here. A noindex tag makes Google drop the page from search results, while the page keeps working for links, bookmarks and returning customers. A few rules:

  • Wait a set number of days (60, for example) instead of adding noindex the moment stock hits 0, so products that sell out every week don’t flip in and out of Google.
  • Take noindexed pages out of your XML sitemap. A sitemap that lists a page you’ve told Google not to index sends mixed signals.
  • Don’t block these pages in robots.txt. Google has to crawl a page to see its noindex tag.

Never coming back: 301 redirect it

For a discontinued product, a permanent (301) redirect to its replacement (the new model, the same item in another size) or to its category sends visitors and Google to a page that sells. Google uses a permanent redirect as a sign that the target should be the page it shows, and recommends it when you’re sure the redirect won’t be reverted. Redirect to the closest match, not the home page. If nothing related exists and the page has no links or traffic worth keeping, deleting it is fine.

How to noindex out of stock products with a snippet

If you only want sold-out product pages out of Google while they’re sold out, this snippet does it. Paste it into a code snippets plugin or your child theme’s functions.php.

// Keep sold-out product pages out of search results (noindex, follow).
add_filter( 'wp_robots', function ( $robots ) {
	if ( function_exists( 'is_product' ) && is_product() ) {
		$product = wc_get_product( get_queried_object_id() );
		if ( $product && ! $product->is_in_stock() ) {
			$robots['noindex'] = true;
			$robots['follow']  = true;
		}
	}
	return $robots;
} );

In our lab, both sold-out pages got noindex, follow and in-stock products were untouched. What it doesn’t do: it leaves the pages in the sitemap, it has no waiting period (a product sold out for one afternoon gets noindex for that afternoon), and it uses WordPress’s own robots tag. SEO plugins such as Yoast SEO and Rank Math print the robots tag themselves, so after adding it, open a sold-out product’s page source and check that the robots tag says noindex.

Set it once with Store SEO Toolkit

Store SEO Toolkit sets one rule for all sold-out products, adds the waiting period and takes noindexed products out of the sitemap. It works on its own or next to Yoast SEO, Rank Math or All in One SEO, and covers their sitemaps too. With another SEO plugin, check a sold-out product’s page source for the noindex tag, as with the snippet.

Store SEO Toolkit in 20 seconds.

Go to Store SEO > Indexing and redirects:

  1. In Out-of-stock products (1), choose Keep in search results, Remove after some days out of stock or Remove while out of stock.
  2. For the waiting period, set Days out of stock (2). The default is 60.
  3. Leave Deleted products ticked, so a product you delete sends its old address to its category with a permanent redirect.
  4. Click Save Changes.
Store SEO Toolkit Indexing and redirects tab with Out-of-stock products set to Remove after some days out of stock and 60 days

The default rule is Keep in search results, so nothing changes until you pick one of the other two. The Hidden products row above it is about products set to Catalog visibility: Hidden, not sold-out products: those are handled only by Out-of-stock products.

With Remove while out of stock, both sold-out pages in our lab got noindex, follow and left the WordPress sitemap, while still loading for visitors. The toolkit also leaves them out of the sitemaps of Yoast SEO, Rank Math and All in One SEO. With Remove after some days out of stock, the milk bottle stayed indexed while its out-of-stock date was recent. Rather than wait 60 days, we backdated that date to 61 days ago, and the page then went noindex and left the sitemap. Restocking a product clears its date, and it’s indexed again.

One catch from our test: the toolkit starts the clock when a product sells out while the toolkit is active. The Leather Sling Chair had sold out before we turned it on, so it had no date and stayed indexed under the 60-day rule. For products that are already sold out when you install it, use Remove while out of stock, or mark the ones that won’t return as discontinued.

Store SEO box on a product saying it has been out of stock long enough to be kept out of search results
The product’s Store SEO box tells you when the rule has kicked in.

For a product that won’t come back, open it and tick Discontinued in its Store SEO box. Leave Send to empty to redirect to the product’s category, or enter a product ID or an address for its replacement. In our test the chair then answered with a 301 to the Furniture category (or to the Ribbed Vase, Tall when we entered its ID) and left the sitemap. Setup for every option is in the Store SEO Toolkit docs.

The toolkit decides what Google sees, not what shoppers see in the shop, so keep using WooCommerce’s setting for that. If you’d rather show sold-out products last, hide them only in some categories or in search, or label them “Sold out” with a badge, that’s what Out of Stock Display Manager does.

FAQ

Does hiding out of stock products hurt SEO?

Not by itself. WooCommerce’s setting only takes products out of the shop, category and search lists, and the product pages stay indexed. What can hurt is what comes with it: categories that turn into empty pages, and pages sold out for so long that Google starts treating them as soft 404s. Decide for each product whether to keep, noindex or redirect its page.

How do I hide out of stock variations in WooCommerce?

The same Hide out of stock items from the catalog setting does it, for products with up to 30 variations. Sold-out combinations then can’t be chosen in the dropdowns. To grey them out instead, Out of Stock Display Manager can do that.

Why are out of stock products still showing in my shop?

Check 3 things. Is the product really Out of stock? On backorder counts as in stock. Is it in a product block on a page or template? Product Collection blocks use their own Stock Status filter. Is a page cache serving the old page? Clear it after changing the setting.

Can I hide out of stock products in one category only?

Not with WooCommerce’s setting, which applies to the whole store. You need a custom query snippet or a plugin. Out of Stock Display Manager hides sold-out products in chosen categories or in search results and leaves them visible elsewhere.

Should I delete out of stock products?

Only when they’re never coming back and the page has nothing worth keeping. A deleted product’s address returns a 404 and its links and reviews are lost, so for a discontinued product with traffic, a 301 redirect to its replacement or category is the better choice. If you do delete products, Store SEO Toolkit’s Deleted products option sends a deleted product’s old address to its category with a 301.

What to do next

Tick Hide out of stock items from the catalog if you don’t want shoppers browsing sold-out products, then check the product blocks on your home page and any category that could empty out. For the product pages, keep the ones that are coming back, noindex the long gaps and redirect the discontinued ones.

To handle that without code, try Store SEO Toolkit: there’s a live demo on the product page, updates and support are included, and it comes with a 14-day money-back guarantee. If your setup is different from ours, open a support ticket.

14-day money-back guarantee

Try it on your store, risk-free

Every plugin includes ongoing updates and support. If it isn’t right for your store, get a full refund within 14 days, no questions asked.