Estimated Delivery Dates Above Checkout
Shows "Estimated delivery: Tue 4 - Thu 6 Nov" at the top of the checkout page, counting only working days from today.
Opens WPIDE on
Code
$min_days = 2; // Fastest delivery, in working days.
$max_days = 4; // Slowest delivery, in working days.
$working_days = array( 1, 2, 3, 4, 5 ); // 1 = Monday ... 7 = Sunday.
$add_working_days = function ( $days ) use ( $working_days ) {
$date = new DateTime( 'now', wp_timezone() );
while ( $days > 0 ) {
$date->modify( '+1 day' );
if ( in_array( (int) $date->format( 'N' ), $working_days, true ) ) {
$days--;
}
}
return $date;
};
$from = $add_working_days( $min_days );
$to = $add_working_days( $max_days );
printf(
'<p class="wpide-delivery-estimate" style="margin:0 0 20px;padding:12px 16px;border-radius:6px;background:#f6f7f7;">📦 Estimated delivery: <strong>%1$s – %2$s</strong></p>',
esc_html( wp_date( 'D j M', $from->getTimestamp() ) ),
esc_html( wp_date( 'D j M', $to->getTimestamp() ) )
);
Notes
Set $min_days and $max_days to your usual delivery window in working days and adjust $working_days.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.