Product7 min read

WooCommerce in stock text without stock management, plus a Sold Out button

Share

Showing WooCommerce in stock text without stock management is a common need for shops that sell made-to-order, digital or always-available goods. Once Track stock quantity is switched off, WooCommerce stops printing In stock on the product page, so customers lose a small but reassuring signal. Two developer snippets published by WooCommerce fix the wording: one restores the In stock label, the other changes the catalogue button to Sold Out when a product runs out. Below is how to add them safely, test them properly and understand what they leave untouched.

Illustration of a shop owner at a wooden desk holding a parcel while looking at a laptop, with boxes stacked around the workspace
Illustration of a shop owner at a wooden desk holding a parcel while looking at a laptop, with boxes stacked around the workspace

Why the In stock label disappears

Every WooCommerce product has an Inventory tab where you choose whether to track stock quantity. With tracking on, WooCommerce counts units and shows availability text based on your stock display format. With tracking off, the product can still be set to In stock, Out of stock or On backorder, but WooCommerce does not display In stock or your chosen stock format on the product page by default.

For a shop that never counts units, the result looks odd. A product is perfectly buyable, yet the page says nothing about availability. WooCommerce documents a filter called woocommerce_get_availability that lets you put the In stock text back for products that are in stock but untracked, without switching quantity tracking on.

Choose a safe home for the code before you start

Both snippets are PHP, so where you put them matters as much as what they say. WooCommerce recommends two places: your child theme's functions.php file, or a code snippets plugin. Never add them to the parent theme. A theme update replaces the parent theme's files and your changes vanish with no warning.

If your site already runs a child theme, confirm it is active and loading correctly before editing it. A snippets plugin is the simpler route for most owners because each snippet can be switched on or off from the dashboard, which also makes testing cleaner later.

Take a fresh backup first, or work on a staging copy of the store. A typing mistake in PHP can stop a page loading. If that happens and you lose access to wp-admin, you can still disable the offending plugin from your hosting file manager.

Restore WooCommerce in stock text without stock management

The official snippet does one narrow job. When WooCommerce prepares a product's availability text, the function checks two things: the product is not managing stock, and the product is in stock. Only when both are true does it set the availability text to In stock. Every other product passes through unchanged.

Copy the code from the WooCommerce documentation rather than retyping it, then make the two edits the documentation asks for.

  1. Back up the site or open your staging copy.
  2. Copy the snippet from the WooCommerce documentation page on displaying In stock without quantity tracking.
  3. Replace your_prefix in the function name with a prefix unique to your child theme or snippets setup, such as your shop's initials.
  4. Replace your-textdomain with the text domain of your child theme or custom plugin, so the wording can be translated.
  5. Save it in the child theme's functions.php file or as a new snippet, then activate it.
  6. Clear any page cache and open an untracked, in-stock product in a private browser window.

Relabel Read more as Sold Out in the shop

The second change affects the button customers see on the shop and category pages. For an out-of-stock product, WooCommerce swaps Add to cart for Read more, which tells a shopper very little until they click through. A separate filter, woocommerce_product_add_to_cart_text, lets you show Sold Out instead.

WooCommerce publishes a ready-made snippet for the Sold Out label. It checks the product type first and leaves variable products and individual variations alone, because each variation can have its own stock level and a single Sold Out label would be misleading. Variable products keep their normal Select options text. For other product types, such as simple products, the button reads Sold Out whenever the product is out of stock.

Before you add it, check one setting. Go to WooCommerce > Settings > Products > Inventory and look at Hide out of stock items from the catalog. When that box is ticked, sold-out products never appear in the shop, so there is no button to relabel. Untick it if you want customers to see sold-out items.

The published function is named custom_sold_out_button_text. Renaming it with your own prefix, as with the first snippet, avoids a clash if another plugin or theme uses the same generic name.

Test both changes on real product types

A visible label after saving is an observation, not proof that your snippet caused it. Your theme, a caching layer or another plugin can also change availability text. Test with a deliberate set of products, then switch each snippet off and confirm the old wording returns. That before-and-after comparison is what shows the code is responsible.

Run these checks logged out or in a private window, so you see what a customer sees rather than an administrator view.

  1. Open a simple product with Track stock quantity off and stock status In stock. The product page should now show In stock.
  2. Open its Inventory tab in the editor. Track stock quantity should still be off and the stock status unchanged.
  3. Set a simple product to Out of stock and visit the shop page. The button should read Sold Out instead of Read more.
  4. Visit a variable product on the shop page. The button should still read Select options.
  5. Open a product that does track quantity and confirm its usual stock text appears as before.
  6. Deactivate each snippet in turn, clear the cache and confirm the original wording comes back.

What these snippets do not change

The availability snippet changes words on the screen and nothing more. WooCommerce states plainly that it does not enable stock management, alter quantities or mark an out-of-stock product as in stock. If a product shows the wrong status, fix the stock status in the product's Inventory tab. The snippet will then reflect that corrected status.

The Sold Out snippet has its own boundary. Variable products keep their default text, so sold-out sizes or colours need checking on the product page itself. If customers report options they cannot select at all, that is a separate problem with variations, prices or attributes rather than button wording.

Both pages are marked as developer-level documentation, and WooCommerce does not support these customisations under its support policy. For conflicts with your theme or other plugins, a developer is the right next step. BugShield can repair broken product variations if your testing turns up a deeper fault.

Sources

WooCommerce in stock text without stock management FAQs

Does the In stock snippet turn on WooCommerce stock management?

No. The snippet only changes the availability text shown to customers. Track stock quantity stays off, quantities are not created or changed, and stock status is still whatever you set in the product's Inventory tab.

Will an out-of-stock product show In stock after adding the snippet?

No. The code only sets the In stock label when a product is both untracked and in stock. Out-of-stock and tracked products keep their normal availability text.

Why do my sold-out products not appear in the shop at all?

Check WooCommerce > Settings > Products > Inventory. When Hide out of stock items from the catalog is ticked, sold-out products are removed from the shop, so the Sold Out button never appears. Untick it to show them.

Why does my variable product still say Select options when everything is sold out?

The WooCommerce snippet deliberately skips variable products and variations, because individual variations can have different stock levels. Those products keep their default button text.

Can I paste these snippets into my theme's functions.php file?

Only into a child theme's functions.php file. Code added to a parent theme is wiped when the theme updates. A code snippets plugin is the other safe option and makes switching each snippet off for testing easier.

Accessibility settings

Adjust how this site looks and moves. Your choices are saved in this browser.