Skip to content

Instantly share code, notes, and snippets.

@shreyans94
Created January 23, 2018 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shreyans94/74549e9b9c5bd3f293d5dc246c28f524 to your computer and use it in GitHub Desktop.
Save shreyans94/74549e9b9c5bd3f293d5dc246c28f524 to your computer and use it in GitHub Desktop.
Change Woocommerce Out of Stock Text
add_filter( 'woocommerce_get_availability', 'wcs_custom_get_availability', 1, 2);
function wcs_custom_get_availability( $availability, $_product ) {
// Change Out of Stock Text
if ( ! $_product->is_in_stock() ) {
$availability['availability'] = __('<b>SOLD OUT!</b><BR><BR>
<font color=#007a00;> </font>', 'woocommerce');
}
return $availability;
}
// Change In Stock Text in future if required - remove comments
// if ( $_product->is_in_stock() ) {
// $availability['availability'] = __('In Stock!', 'woocommerce');
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment