I was able to do this a while back by following this WooCommerce tutorial:
There may come a time where you would like change the text displayed
on a product’s page when it is In Stock or Out of Stock.Simply add the following code to the ‘custom functions’ area of your
functions.php
file:
/**
* Change In Stock / Out of Stock Text
*/
add_filter( 'woocommerce_get_availability', 'wcs_custom_get_availability', 1, 2);
function wcs_custom_get_availability( $availability, $_product ) {
// Change In Stock Text
if ( $_product->is_in_stock() ) {
$availability['availability'] = __('Available!', 'woocommerce');
}
// Change Out of Stock Text
if ( ! $_product->is_in_stock() ) {
$availability['availability'] = __('Sold Out', 'woocommerce');
}
return $availability;
}
Now simply change the Available! and Sold Out text to be whatever you
would like.
Use a custom function in the functions.php
file. If you’re editing those core WooCommerce templates, you risk losing your changes on plugin upgrades. If you have a custom function in that functions.php
file, it should work regardless of plugin upgrades, theme updates, etc.