Custom Text for In Stock and Out of Stock Text in Woocommerce

Copy and Paste the code in your theme’s functions.php

add_filter( ‘woocommerce_get_availability’, ‘custom_get_availability’, 1, 2);

function custom_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;
}

Reference: http://www.terrytsang.com/tutorial/woocommerce-change-in-stock-or-out-of-stock-text-in-woocommerce/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s