By default, WooCommerce doesn’t display the “in stock” status or availability on the product page. While this is an expected standard for online shoppers these days I am still surprised why this is the case. Since I found the solution, I wanted to share it with you since I know you’re not the only one who will find this little WooCommerce modification useful.
Why Show an “In Stock” Message?
“In Stock” or “Out of Stock”, which ever the case may be, showing the availability status even if you never, ever run out of stock in an item helps conversion rates because it provides a signal to the customer that it is in fact in stock. Whether or not you decide to show how many are available or show low stock quantities, a simple, “In Stock”, can be the most helpful thing when shopping online.
Here’s How to Show “In Stock”
- In your WordPress admin, navigate to Appearance > Editor.
- Click functions.php on the right.
- Go to the bottom of the file and paste the following code then save.
// Hook in
add_filter( 'woocommerce_get_availability', 'custom_override_get_availability', 10, 2);
// The hook in function $availability is passed via the filter!
function custom_override_get_availability( $availability, $_product ) {
if ( $_product->is_in_stock() ) $availability['availability'] = __('In stock', 'woocommerce');
return $availability;
}Is Your Product In Stock?

Let me know if this worked for you or if you found another way how to do this.
THANKS. THIS IS A GREAT SNIPPET! I just used it and it works =) thanks again!
I get
Parse error: syntax error, unexpected ‘function’ (T_FUNCTION) in /home/mysite/public_html/sfdemo/wp-content/themes/sfdemo/functions.php on line 62
Sadly not working :-/
You get the parsing error probably because you made the same mistake as me and copied it without checking it again. Check if you copy the numbers 1-8 with it aswell. They are not part of the code. The function starts at “add_filter( ‘woocommerce_get_availability’, ‘custom_override_get_availability’, 1, 2);”
He’s right, there is a mistake at line 2:
add_filter( ‘woocommerce_get_availability’, ‘custom_override_get_availability’, 1, 2);
It should be:
add_filter( ‘woocommerce_get_availability’, ‘custom_override_get_availability’, 10, 2);
Thanks Cristi, I’ll update the code!
Can I have this feature for variable products to?
I wish to have “Availability : In Stock” by default (my varible product will only have products in stock dropdown choices)
I tried this but not working on products with variations
Can I do this with multilingual site?
For proper translation handling you need to match the string to the WooCommerce original and write ‘In stock’, with a lowercase ‘s’, like so:
if ( $_product->is_in_stock() ) $availability['availability'] = __('In Stock', 'woocommerce');For proper translation handling you need to match the string to the WooCommerce original and write ‘In stock’, with a lowercase ‘s’, like so:
if ( $_product->is_in_stock() ) $availability['availability'] = __('In stock', 'woocommerce');Confirmed, you have to use ‘In stock’ with a lower case S to support other languages
Still working, thanks dude!
Not working in Woocommerce ver. 3+
Oh, thanks.
I am developing a Woocommerce plugin. I manipulated the string successfully.
thats awesome!!
It is probably not possible to to use an image instead of text?
Hi Klaus, yes absolutely. You can use an image instead by using
instead of
or etc.
Not working. Any chance you fix it to work on the current WooCommerce? Many thanks <3
we have a few categories that have products that never go out of stock (I mean, even if we run out of stock, we accept orders in an unlimited number)
So, we want to show “In Stock” on those categories’ products, even if the products are actually low stock or out of stock.
is there a code to override this in some categories?
Thanks