WooCommerce allows you to display the out-of-stock message on the product page but you cannot customize it which means that the users will come to know that the product is out of stock, but it won’t tell the users why and when the product will be back in stock.
This can cause you a serious decrease in the number of sales, and it will also affect the user experience. But don’t worry, I got you covered here!
In today’s article, I’ll share a step-by-step process that you can follow to display customized messages on the product page for out-of-stock products.
Here’s a quick sneak peek of the final results, we’ll be achieving today.
On This Page
- 1 How to Show Out of Stock Message on Product Page?
- 1.1 1. Install and Activate the Woosuite Lead Time Plugin
- 1.2 2. Navigate to Woosuite Lead Time
- 1.3 3. Display a Custom Message for Out of Stock Products on the Product Page
- 1.4 4. Select the Products for Which You Want to Display the Lead Times
- 1.5 5. Set Custom Message for Out of Stock Products
- 1.6 6. Set the Global Lead Time
- 1.7 7. Save Changes
- 1.8 8. Final Results
- 2 Method 2: Change stock availability text using code:
- 3 Conclusion
How to Show Out of Stock Message on Product Page?
Follow the following steps to display a customized message on the product pages for out-of-stock products.
1. Install and Activate the Woosuite Lead Time Plugin
Note: You can skip this step if you have already installed and activated the Woosuite Lead Time plugin.
To install the Woosuite Lead Time plugin, you will need to install the Woosuite Core plugin and activate it with the help of a license key. We have created a Quick Start Guide for you to figure out how to install and activate the Woosuite Lead Time plugin.
2. Navigate to Woosuite Lead Time
Once you have installed and activated the plugin, now from your WordPress Admin Dashboard, navigate to Woosuite » Lead Time.
3. Display a Custom Message for Out of Stock Products on the Product Page
We want to display the custom message for out-of-stock products on the product page, which will help the customers know about the products' stock status.
So to display the custom message, check the Single Product Page checkbox. This will display the message on the single product pages.
4. Select the Products for Which You Want to Display the Lead Times
Here you need to select the products you want to display the lead times and message on the product page. You can choose whether to display it for products based on their status:
- In-stock Products: This is useful for displaying lead times for custom or handmade products.
- Out of stock Products: This only displays the designated lead time if the item is out of stock.
- Products on Backorder: This only displays the lead time you've specified when the item is on backorder.
This tutorial displays the lead times and custom messages for out-of-stock products on the product page only, so I have checked the “out-of-stock products” checkbox.
This will let the users know about the stock status by displaying the custom message and lead time only for out-of-stock products on the product page, which means if a product is in stock, the customers won’t see any information.
5. Set Custom Message for Out of Stock Products
To display the custom message for out-of-stock products, enter the message in the Lead Time Prefix field.
I have set it to ”Sorry this product is currently out of stock but will be back in stock”, you can set it as you want.
6. Set the Global Lead Time
This will be displayed next to the custom message we set up in the previous step. This will tell the customers when the product will be back in stock. This will be the global lead time, which will be the same for all the out-of-stock products.
So, to set the global lead time, enter the number in the Global Lead Time field and select the Lead Time Unit. You can select the unit as:
- Day
- Week
- Month
I have selected the day as a unit and set the lead time as 6 days. You can set it according to your store.
7. Save Changes
Now, click on the Save Changes button at the top right corner to save the changes.
8. Final Results
Now, if you visit the product page of an out-of-stock product, you’ll see the custom message displayed on it, which will let the users know when the product will be back in stock.
Method 2: Change stock availability text using code:
function ws_woocommerce_get_availability_text( $text, $product ) {
if (!$product->is_in_stock()) {
$text = 'Back in stock soon';
} else {
// $text = 'In stock';
}
return $text;
}
add_filter( 'woocommerce_get_availability_text', 'ws_woocommerce_get_availability_text', 999, 2);
Conclusion
So there you go, now you know how to display a custom message for out-of-stock products on the product page.
You can play with other settings and display the lead time for backorder products and improve the user experience.
Let me know in the comments section if you have any queries or contact our customer support. Our dedicated customer support team typically replies within 48 hours.
To get started, download the Woosuite Lead Time plugin today!