# Hide Express Shipping After the Daily Cut-Off

> Removes your next-day or express shipping option after a set time and at weekends, so customers are not promised a delivery you cannot dispatch.

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

## Code

```php
$wpide_express = array(
    'rate'      => 'flat_rate:4', // Method ID or rate ID of the express option.
    'cutoff'    => '14:00',       // Last order time (24h).
    'weekends'  => false,         // Offer express at weekends.
);

add_filter( 'woocommerce_package_rates', function ( $rates ) use ( $wpide_express ) {
    $now     = current_time( 'H:i' );
    $weekend = (int) current_time( 'N' ) >= 6;

    if ( $now < $wpide_express['cutoff'] && ( $wpide_express['weekends'] || ! $weekend ) ) {
        return $rates;
    }

    foreach ( $rates as $id => $rate ) {
        if ( $id === $wpide_express['rate'] || $rate->get_method_id() === $wpide_express['rate'] ) {
            unset( $rates[ $id ] );
        }
    }

    return $rates;
}, 20 );

add_filter( 'woocommerce_cart_shipping_packages', function ( $packages ) {
    foreach ( $packages as $i => $package ) {
        $packages[ $i ]['wpide_hour'] = current_time( 'Y-m-d H' );
    }

    return $packages;
} );
```

## Notes

Uses the site's timezone, and rates refresh every hour so the option disappears on time for open carts.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Hide Express Shipping After the Daily Cut-Off" 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/
