With the following code I display a custom message on WooCommerce checkout page. When a customer places an order on a Saturday and Sunday, the order will be delivered on the next Monday. If a customer places an order between Monday and Friday after 22:00h, the delivery will take place the day after tomorrow. When a customer places an order between Monday and Friday before 22:00h, delivery will take place the next day.
function bbloomer_notice_shipping() {
date_default_timezone_set( 'Europe/Amsterdam' );
// if SAT delivery will be MON
if ( date( 'N' ) >= 6 ) {
$del_day = date( "l jS F", strtotime( "next monday" ) );
$order_by = "maandag";
}
// if bestelling vindt plaats op MON/FRI na 22 uur delivery will be day after tomorrow
elseif ( date( 'H' ) >= 22 ) {
$del_day = date( "l jS F", strtotime( "tomorrow + 1day" ) );
$order_by = "overmorgen";
}
// if bestelling vindt plaats op MON/FRI voor 22 uur delivery will be tomorrow
else {
$del_day = date( "l jS F", strtotime( "tomorrow" ) );
$order_by = "vandaag";
}
$chosen_shipping_method_id = WC()->session->get( 'chosen_shipping_methods' )[0];
if ($chosen_shipping_method_id == 'flat_rate:1') {
$verzend_melding = 'wordt bezorgt op '.$del_day.'';
}
elseif ($chosen_shipping_method_id == 'local_pickup:4') {
$verzend_melding = 'kan worden opgehaald op '.$del_day.'';
}
elseif ($chosen_shipping_method_id == 'local_pickup:3') {
$verzend_melding = 'kan worden opgehaald op '.$del_day.'';
}
echo "<tr><td colspan='2'><i>Uw bestelling $verzend_melding</i></td></tr>";
}
Now, what I am trying to do is to add this message/notice to Email notifications and in backend order-view within WooCommerce. Could someone point me in the proper direction?