I wrote some code for displaying a custom backorder message on the product detail page which is based on the product category.
function custom_backorder_message( $text, $product ){
if ( $product->managing_stock() && $product->is_on_backorder( 1 ) ) {
if( has_term( 'bridal-line', 'product_cat' ) ) {
$text = __( 'Your piece will be handcrafted for you. Upon order we will manufacture your piece of eternity. Sadly, we can not give you a timeline, due to Covid 19, but are expecting 5-7 weeks', 'text-domain' );
}else {
$text = __( 'This product is currently out of stock, but upon order we will handcraft your piece. Sadly, we can not give you a timeline, due to Covid 19, but are expecting 6-8 week.', 'text-domain' );
}
}
return $text;
}
add_filter( 'woocommerce_get_availability_text', 'custom_backorder_message', 10, 2 );
Right now, on the cart page "Available on backorder" gets displayed. How can I show the right backorder message there?
Any help is appreciated!