Skip to content

Instantly share code, notes, and snippets.

@mitchellkrogza
Last active February 23, 2022 08:50
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 mitchellkrogza/670096d1999a8887a40a8d635c45fe03 to your computer and use it in GitHub Desktop.
Save mitchellkrogza/670096d1999a8887a40a8d635c45fe03 to your computer and use it in GitHub Desktop.
Woocommerce Change Backorder Message
// CHANGE WOOCOMMERCE BACKORDER TEXT
// Here I have used a 3 line message with inline styles to change the color and add line breaks
// Adapt this as you see fit
// Use Code Snippets Plugin to add this function or add yourself to functions.php of your child theme
// https://wordpress.org/plugins/code-snippets/
function mywoo_backorder_message( $text, $product ){
if ( $product->managing_stock() && $product->is_on_backorder( 1 ) ) {
$text = __( '<strong><p style="color:green">New Stock is on its way !!!!<br>Backorder now - first come first served<br>Please allow 1 – 3 weeks for delivery of this item</p></strong><br>', 'your-textdomain' );
}
return $text;
}
add_filter( 'woocommerce_get_availability_text', 'mywoo_backorder_message', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment