How to Change Out Of Stock Text in WooCommerce?

There are numerous plugins for WooCommerce which can help you to change the stock status text. But, if you do not wish to change stock status text via a plugin, you can follow the steps given below and make modifications in your WooCommerce theme.

Change Out Of Stock Text 

To Change Out Of Stock Text you need to add the following lines of code in your theme's functions.php file. Just append the following lines of code at the bottom of functions.php

add_filter( 'woocommerce_get_availability', 'mgk_get_availability', 1, 2);
function mgk_get_availability( $availability, $_product )
      //change text "In Stock' to 'AVAILABLE'
     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;

Don't forget to replace the intended text in the above function as per your requirement or language. If you face any problems or need our professional services, please email us at [email protected].


Join our Newsletter

Never miss the latest offers, voucher codes and useful articles delivered weekly in your inbox.