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.

Conclusion

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!

Frequently asked questions

Can I change the out-of-stock text for specific products or product categories in WooCommerce?

Yes, you can change the out-of-stock text for specific products or product categories in WooCommerce by using custom code or plugins that offer advanced product customization features. Some plugins allow you to set custom out-of-stock messages on a per-product or per-category basis, giving you more control over how the message is displayed to customers.

Will changing the out-of-stock text in WooCommerce affect my store’s SEO or search engine rankings?

Changing the out-of-stock text in WooCommerce is unlikely to have a direct impact on your store’s SEO or search engine rankings. Search engines primarily focus on factors such as content relevance, site speed, and user experience when determining search rankings. However, providing clear and informative messages to users, including out-of-stock notifications, can contribute to a positive user experience, which may indirectly impact SEO.

How can I translate or localize the out-of-stock text in WooCommerce for different languages or regions?

To translate or localize the out-of-stock text in WooCommerce for different languages or regions, you can use translation plugins such as WPML or Polylang, which offer multilingual support and allow you to translate text strings, including out-of-stock messages, into multiple languages. Alternatively, you can use WordPress’s built-in localization features to create custom language files for your theme or plugins and translate the out-of-stock text manually.

Can I customize the styling or appearance of the out-of-stock text in WooCommerce to match my store’s branding?

Yes, you can customize the styling or appearance of the out-of-stock text in WooCommerce to match your store’s branding by adding custom CSS styles or using theme customization options. Most WooCommerce themes provide options to customize the appearance of various elements, including out-of-stock messages, through the WordPress Customizer or theme settings. Additionally, you can use custom CSS to override default styles and apply your own custom styles to the out-of-stock text.

Will changing the out-of-stock text in WooCommerce affect the functionality of inventory management or backorder settings?

Changing the out-of-stock text in WooCommerce should not affect the functionality of inventory management or backorder settings. WooCommerce’s inventory management features, including stock tracking and backorder handling, are separate from the display of out-of-stock messages and remain unaffected by changes to the text. However, it’s essential to test any changes to ensure they do not inadvertently impact other aspects of your store’s functionality.

How to get started?

Learn more

WooCommerce Maintenance

Save 33% with our Annual pricing plan.

Get Started

Coupon Code Applied!

Take your time and continue browsing our services.

Alexey Seryapin
Founder of WPServices