How to Change Out of Stock Text in WooCommerce Easily

How to Change Out of Stock Text in WooCommerce Easily

Are you curious about how to replace the “Out of stock” message on your online store’s product listings in WooCommerce? If you are, then this guide is designed just for you. By default, when a product is unavailable for purchase, WooCommerce displays the label “Out of stock.” This can be a bit confusing for your customers, potentially leading them to look for the product elsewhere. To enhance the shopping experience, it’s a good idea to change this text to something more customer-friendly, such as “Temporarily Unavailable” or “Coming Soon,” or any other text that suits your preferences. So, how to change out of stock text in WooCommerce?

2 Ways to Change Out of Stock Text in WooCommerce

If you’re running an online store with WooCommerce, you may have encountered the issue of wanting to change the default “Out of Stock” text that appears when a product is not available for purchase. Fortunately, there are two main methods to achieve this: using custom PHP code or utilizing a plugin. In this guide, we’ll walk you through both methods, so you can choose the one that best fits your needs.

Changing Out of Stock Text in WooCommerce Using the “Woo Custom Stock Status” Plugin

The “Woo Custom Stock Status” plugin is a user-friendly tool that allows you to easily customize the out-of-stock text for your WooCommerce products. Follow these steps to get started:

  1. Log in to your WordPress admin panel.
  2. Navigate to Plugins > Add New.
  3. In the search bar on the top right, type “Woo Custom Stock Status” and press Enter.
  4. Look for the “Woo Custom Stock Status” plugin in the search results.
  5. Click the “Install Now” button next to the plugin, and once it’s installed, click “Activate.” How to Change Out of Stock Text in WooCommerce
  6. After activation, you should see a new menu item called “Stock Status” in your WordPress dashboard. Click on it.
  7. Inside the “Stock Status” settings, you’ll find options to customize the out-of-stock text for various scenarios, such as “Out of Stock,” “Low Stock,” and “Backorder.”
  8. Click on the text field next to “Out of Stock” to enter your preferred text. For example, you can change it to “Temporarily Unavailable” or any other text that suits your needs. How to Change Out of Stock Text in WooCommerce
  9. You can also customize the text for other stock statuses as needed.
  10. After customizing the text to your satisfaction, don’t forget to click the “Save Changes” button to apply your modifications.
  11. To confirm that the changes have taken effect, visit your WooCommerce store’s product pages where products are marked as “Out of Stock.”
  12. You should now see your customized text in place of the default “Out of Stock” message.

That’s it! You’ve successfully changed the out-of-stock text in WooCommerce using the “Woo Custom Stock Status” plugin. This straightforward solution allows you to tailor the messaging to better suit your store and provide a more user-friendly experience for your customers.

Modify Out of Stock Text in WooCommerce Using Custom PHP Code

The initial approach is intended for individuals comfortable with coding, and you don’t need to be a seasoned WordPress developer for this. Make sure to back up your website before making any code edits. Just follow these straightforward steps:

  1. Access your WordPress Dashboard and navigate to Appearance > Theme Editor.
  2. Locate the function.php file on the right side of your page and click to open it.
  3. Scroll down to the bottom of the file.
  4. Copy and paste the following code into the file, then save your changes:
add_filter( 'woocommerce_get_availability', 'change_out_of_stock_text_woocommerce', 1, 2);
function change_out_of_stock_text_woocommerce( $availability, $product_to_check ) {
    // Modify Out of Stock Text
    if ( ! $product_to_check->is_in_stock() ) {        
        $availability['availability'] = __('Coming Soon', 'woocommerce');        
    }
    return $availability;
}

 

Please note: You can replace the “Coming Soon” text with any other text of your choice.

Remove out of stock label on product images    

After updating your theme file, the out-of-stock text on your WooCommerce products will be changed. But if you also want to alter the out-of-stock label on the product images displayed on the shop page, follow these steps:

If you have an out-of-stock label on your product images like this: How to Change Out of Stock Text in WooCommerce

You can remove the label by adding the following CSS code to your WordPress website. To do this, go to WordPress Dashboard > Appearance > Customize, click on Additional CSS, and add the code below, then publish it:

.ast-shop-product-out-of-stock {
    display: none;
}

Since the “Out of Stock” label has been removed, you can now add your custom label by inserting this PHP code snippet into your function.php file:

// Adding an out-of-stock overlay to product images
add_action( 'woocommerce_before_shop_loop_item_title', function() {
    global $product;
    if ( !$product->is_in_stock() ) {
        echo '<span class="sold-out-overlay">Coming Soon</span>';
    }
});

After inserting the PHP code snippet, add the following CSS code in Additional CSS to style your custom label:

.sold-out-overlay {
    background: red;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 5px 10px;
    position: absolute;
    right: 0px;
    top: 0px;
}

 

Please note: You can adjust the appearance of the custom label by editing the CSS code above.

Final Words

In conclusion, swapping out the “Out of Stock” message in WooCommerce is a breeze with the right steps. By following the easy instructions discussed in this article, you can give your online store a personalized touch and keep your customers informed about product availability. Don’t hesitate to make this simple change to enhance your WooCommerce store and provide a better shopping experience for your visitors.

FAQs [How to Change Out of Stock Text in WooCommerce]

Why should I change the “Out of Stock” text in WooCommerce?

Changing the “Out of Stock” text allows you to customize your online store’s messaging and provide more relevant information to your customers. It can improve the user experience and help customers make informed decisions.

Is it difficult to change the “Out of Stock” text in WooCommerce?

Not at all! It’s a straightforward process that can be done with a few simple steps. Our article explains the process in detail.

Can I change the “Out of Stock” text to something unique for each product?

Yes, you can! WooCommerce allows you to set different “Out of Stock” messages for each product or product category, giving you full flexibility.

Will changing the “Out of Stock” text affect my website’s performance?

No, changing the text itself won’t impact your website’s performance. It’s a cosmetic change that doesn’t require extensive coding or resource usage.

Are there any limitations to what I can change the “Out of Stock” text to?

While you have the freedom to choose different text, it’s essential to keep it informative and clear. Misleading or confusing messages may not benefit your customers.

Do I need coding skills to change the “Out of Stock” text?

No coding skills are necessary for most changes. The article provides step-by-step instructions that anyone can follow.

Can I revert to the default “Out of Stock” text if needed?

Yes, you can always revert to the default text if you change your mind or encounter any issues.

Will changing the “Out of Stock” text affect my WooCommerce updates?

In general, changing the “Out of Stock” text should not interfere with WooCommerce updates. However, it’s a good practice to check for compatibility with new updates.

Can I use this method to change other text on my WooCommerce site?

While this article focuses on the “Out of Stock” text, similar methods can often be applied to customize other text elements in WooCommerce.

Is there a recommended “Out of Stock” text that works best for conversions?

The effectiveness of the “Out of Stock” text can vary depending on your audience and products. It’s a good idea to A/B test different messages to see what resonates best with your customers.