# "Order Within X Hours for Same-Day Dispatch" Notice

> Shows a live notice on product pages telling shoppers how long they have left to order for dispatch today, or that orders ship on the next working day.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, product-page, shipping, urgency
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-dispatch-cutoff-notice/

## Code

```php
add_action( 'woocommerce_single_product_summary', function () {
    $cutoff       = '14:00';                  // Daily dispatch cutoff.
    $working_days = array( 1, 2, 3, 4, 5 );   // Days you ship.

    global $product;

    if ( ! $product instanceof WC_Product || ! $product->is_in_stock() || $product->is_virtual() ) {
        return;
    }

    $now      = new DateTime( 'now', wp_timezone() );
    $deadline = new DateTime( 'today ' . $cutoff, wp_timezone() );

    if ( in_array( (int) $now->format( 'N' ), $working_days, true ) && $now < $deadline ) {
        $diff = $now->diff( $deadline );
        $text = sprintf( 'Order within %1$dh %2$dm for dispatch today.', $diff->h, $diff->i );
    } else {
        $text = 'Order now for dispatch on the next working day.';
    }

    echo '<p class="wpide-dispatch-notice" style="padding:8px 12px;border-radius:4px;background:#f0f6fc;">&#128666; ' . esc_html( $text ) . '</p>';
}, 25 );
```

## Notes

Set $cutoff (24h, site timezone) and $working_days (1 = Monday ... 7 = Sunday).

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find ""Order Within X Hours for Same-Day Dispatch" Notice" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
