How to replace woocommerce “Out of stock” by “sold”

For replacing woocommerce “out of stock” with sold or another custom name.

Copy below code and paste in your functions.php file.

//  You can replace this word Sold word with your own word

add_filter('woocommerce_get_availability', 'availability_filter_func');

function availability_filter_func($availability)
{
$availability['availability'] = str_ireplace('Out of stock', 'Sold', $availability['availability']);
return $availability;
}
start a project with us