Your Dedicated Partner for All Things WordPress

How to Change the Out of Stock Text in WooCommerce

Table of Contents

Having out of stock products can be frustrating for both customers and store owners. When a product runs out of stock, WooCommerce displays a default text that says “Out of stock” on the product page. While this text accurately describes the product’s status, it can make potential customers lose interest in purchasing from your online store. Thankfully, WooCommerce allows you to customize the out of stock text and make it more appealing to your audience. In this blog post, we’ll show you the step-by-step process of changing the out of stock text in WooCommerce and how doing so can positively impact your sales.

Step 1: Install and activate the Code Snippets plugin

Before we jump into the nitty-gritty of customizing the out of stock text, you must first install the Code Snippets plugin. This plugin allows you to add custom code snippets to your WordPress website without touching your theme’s files. Head over to the WordPress plugin directory and install the Code Snippets plugin. Once you’ve activated the plugin, navigate to the “Snippets” tab, which should appear in your WordPress dashboard’s main menu.

Step 2: Create a new snippet

Next, click on the “Add New” button to create a new code snippet. You should see a form where you can enter the details of your new snippet. Give your new snippet a title that describes what it does, like “Customize Out of Stock Text.” In the “Code” section, paste the following code snippet:

add_filter(‘woocommerce_get_availability’, ‘custom_get_availability’, 1, 2);

function custom_get_availability($availability, $_product) {
// Change the out of stock text here
if (!$_product->is_in_stock()) {
$availability = __(‘Sorry, this product is currently sold out’, ‘woocommerce’);
return $availability;

This code snippet uses the ‘woocommerce_get_availability’ filter to customize the out of stock text. You can replace the text “Sorry, this product is currently sold out” with any phrase that you think can help sell the product better.

Step 3: Save and activate your snippet

After pasting the code snippet, click on the “Save Changes and Activate” button. This should activate your new code snippet. If the snippet is active, WooCommerce should now display your custom text instead of the default “Out of Stock” text.

Step 4: Test your changes

To make sure that your custom text is working correctly, go to one of your product pages that’s currently out of stock. The page should now display the custom text you entered earlier. If that’s not the case, try clearing your WordPress cache or asking for help from a developer.

Step 5: Rinse and repeat

After successfully customizing your out of stock text, you can repeat the process for other products on your website. Be sure to think carefully about your choice of words and how it can affect your sales. The text you enter should be clear and compelling, urging customers to check back later or choose a similar product.


Customizing the out of stock text is a quick and easy way to make your WooCommerce store more user-friendly. The default “Out of Stock” text can sometimes put off potential customers, but with a customized text, you can turn a negative experience into a positive one. By following the steps we outlined in this blog post, you can change the out of stock text to reflect your brand’s tone of voice and better communicate with your customers. Take action today and boost your sales!

How to get started?

Learn more

WooCommerce Maintenance

Save 33% with our Annual pricing plan.

Get Started

Looking for help? Chat with us.

Are you in need of assistance or guidance? Look no further! Our dedicated team is here and ready to help. Chat with us today and let’s work together to find the perfect solution for your needs.

Our support team will get you:

I believe every website owner deserves a reliable professional support always by their side.

Alexey Seryapin
Founder of WPServices

Coupon Code Applied!

Take your time and continue browsing our services.

Alexey Seryapin
Founder of WPServices