Paste the following code in functions.php:
/* backorder text on single product page */ function so_42345940_backorder_message( $text, $product ){ if ( $product->managing_stock() && $product->is_on_backorder( 1 ) ) { $text = __( 'Please allow 20 days for delivery of this item', 'your-textdomain' ); } return $text; } add_filter( 'woocommerce_get_availability_text', 'so_42345940_backorder_message', 10, 2 ); /* Backorder text on cart page */ function alt_message() { return '
Please allow 20 days for delivery of this item
‘; } function backorder_text($availability) { $altmessage = alt_message(); foreach($availability as $i) { $availability = str_replace(‘Available on backorder’, $altmessage, $availability); } return $availability; } add_filter(‘woocommerce_get_availability’, ‘backorder_text’); function woocommerce_custom_cart_item_name( $_product_title, $cart_item, $cart_item_key ) { $altmessage = alt_message(); if ( $cart_item[‘data’]->backorders_require_notification() && $cart_item[‘data’]->is_on_backorder( $cart_item[‘quantity’] ) ) { $_product_title .= __( ‘ – ‘. $altmessage, ‘woocommerce’ ) ; } return $_product_title; } add_filter( ‘woocommerce_cart_item_name’, ‘woocommerce_custom_cart_item_name’, 10, 3);
Paste the following in Appearance > Customise > Additional CSS:
.backorder_notification{ display: none; } .backorder_notification_custom{ display: block; margin-bottom:0px; }
Source: https://www.choosepizzi.net/woocommerce-modify-backorder-message-single-product-and-cart/