Skip to content

Instantly share code, notes, and snippets.

@DeveloperWil
Created November 16, 2020 03:13
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 DeveloperWil/1b9d95fc371dfb8f24fbd74873ce7267 to your computer and use it in GitHub Desktop.
Save DeveloperWil/1b9d95fc371dfb8f24fbd74873ce7267 to your computer and use it in GitHub Desktop.
WooCommerce: Change "Out of stock" message to "Sold"
/**
* Change "Out of stock" with "Sold"
*
* @author Wil Brown zeropointdevelopment.com
* @param $availability
* @return mixed
*/
function zpd_availability_filter_func($availability)
{
$availability['availability'] = str_ireplace( 'Out of stock', 'Sold', $availability['availability'] );
return $availability;
}
add_filter('woocommerce_get_availability', 'zpd_availability_filter_func');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment