Skip to content

Instantly share code, notes, and snippets.

@Shininglow
Created September 4, 2017 07:21
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 Shininglow/f1c475bd626da4fe634564d0bb26a11c to your computer and use it in GitHub Desktop.
Save Shininglow/f1c475bd626da4fe634564d0bb26a11c to your computer and use it in GitHub Desktop.
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment