lmartins
10/24/2014 - 8:11 AM

https://support.woothemes.com/hc/en-us/articles/202845976-How-to-Change-In-Stock-Out-of-Stock-Text There may come a time where you would li

https://support.woothemes.com/hc/en-us/articles/202845976-How-to-Change-In-Stock-Out-of-Stock-Text

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:

You may want to leave out that first right before it in the file you're adding the code to. Now simply change the Available! and Sold Out text to be whatever you would like.

<?php

/**
 * 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;
}