Skip to content

Instantly share code, notes, and snippets.

@barbwiredmedia
Last active July 6, 2018 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save barbwiredmedia/e86493f24e0f95ad4016 to your computer and use it in GitHub Desktop.
Save barbwiredmedia/e86493f24e0f95ad4016 to your computer and use it in GitHub Desktop.
Wordpress Woocommerce out of stock, backorder
//Backorder
function backordertext($available) {
foreach ($available as $i) {
$available = strreplace('Available on backorder', 'This item is currently only available for backorder. Please allow 30-45 days from time of order for delivery.', $available);
}
return $available;
}
addfilter('woocommercegetavailability', 'backordertext');
//Out of Stock
add_filter('woocommerce_get_availability', 'availability_filter_func');
function availability_filter_func($availability) {
$availability['availability'] = str_ireplace('Out of stock', 'This item is currently out of stock. Please check back again at a later date."', $availability['availability']);
return $availability;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment