Sometimes you may want to change the default text that WooCommerce states under a products availability.
By default, WooCommerce lists products in stock as either ‘X in stock’ or only showing the message when you are running low on stock. These are set in the WooCommerce settings:
WooCommerce -> Settings -> Products -> Inventory -> Stock display format
If you want to override this to show another message for either In stock or Out of stock, you will need to override the default by adding this snippet into your functions.php file:
add_filter( 'woocommerce_get_availability', 'pro_custom_get_availability', 1, 2);
function pro_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;
}
Above I have set ‘In stock’ to show ‘Available’, and ‘Out of stock’ to display as ‘Sold out’, however you can change these to say anything you wish.
Hope this helps.