How to change In Stock or Out of Stock text in WooCommerce


WooCommerce has become one of the popular eCommerce WordPress plugin and just exceeded 1 million downloads few months ago. Anyway, when more and more people are using the plugin, i believe you will come to a point when you need simple customization or tweak that will give you hard time as you are not coder or someone who know PHP.

Today, i would like to share how you actually can change default “In Stock” or “Out of Stock” text at WooCommerce product page. Let’s get started by giving you example:

1. You would like to change “In Stock” to “Available”

2. You would like to change “Out of Stock” to “Sold Out”

Step 1: Open your functions.php file at your current theme folder (wp-content/themes/[THEME]/functions.php) You can download functions.php file from FTP, edit then upload again, OR you cab go to WordPress Admin -> Appearance -> Editor, and click functions.php to edit then save.

Step 2: Put below code to the bottom of the file:

add_filter( 'woocommerce_get_availability', 'custom_get_availability', 1, 2);
function custom_get_availability( $availability, $_product ) {
    //change text "In Stock' to 'SPECIAL ORDER'
    if ( $_product->is_in_stock() ) $availability['availability'] = __('AVAILABLE', 'woocommerce');
    //change text "Out of Stock' to 'SOLD OUT'
    if ( !$_product->is_in_stock() ) $availability['availability'] = __('SOLD OUT', 'woocommerce');
        return $availability;

Final Step: Save the file above and done. You’ve told WooCommerce to get custom status for stock display at single pages. Hope you get some idea on how to tweak WooCommerce by reading more my articles.


  1. Hi,
    I’ve got your original posted code working to change the out of stock message on my individual product pages, but I would also like to change the message on the product archive pages (eg Shop page, product category page).

    These are controlled by my child theme/woocommerce/archive-product.php, but this file doesn’t have the out of stock code – it calls a woocommerce loop – is there a simple way to globally control this? I tried 2 plugins (Stock message + WooCommerce Out of Stock Message) but they are working for the product archives.

    aybe it’s specific to my theme ( / or my child theme

    Any suggestions would be much appreciated.

  2. Awesome! But I see that function is escaping all the HTML I put in there. How can I do to show some colors and bold letters?

  3. Thank you so much for this – I would also like to include a link where they can add themselves to a waiting list, but my html is out put as text. How can I output the message as HTML?

  4. I would love to know if you had an answer for how to have to “Out of Stock” text changed on the product catalog (archive) and not just the individual products page.

    In my case, I would love for the images in the catalog to have “Coming Soon!” across the top instead of “Out of Stock”.

    I look forward to your response. Your solution for the product page itself is one of the cleanest I have found. Great work!

Leave a Comment.