# Delivery Day Selector on the Block Checkout

> Adds a required "Delivery day" dropdown to the Checkout block listing the next working days, stored on the order with WooCommerce's additional fields API.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, block-checkout, delivery, fields
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-block-checkout-delivery-day/

## Code

```php
$wpide_delivery_days = array(
    'lead_days' => 1,  // First day offered = today + this many days.
    'count'     => 6,  // How many days to offer.
    'weekends'  => false,
);

add_action( 'woocommerce_init', function () use ( $wpide_delivery_days ) {
    if ( ! function_exists( 'woocommerce_register_additional_checkout_field' ) ) {
        return;
    }

    $options = array();
    $day     = new DateTimeImmutable( 'today', wp_timezone() );
    $day     = $day->modify( '+' . (int) $wpide_delivery_days['lead_days'] . ' days' );

    while ( count( $options ) < $wpide_delivery_days['count'] ) {
        if ( $wpide_delivery_days['weekends'] || (int) $day->format( 'N' ) < 6 ) {
            $options[] = array( 'value' => $day->format( 'Y-m-d' ), 'label' => wp_date( 'l j F', $day->getTimestamp() ) );
        }

        $day = $day->modify( '+1 day' );
    }

    woocommerce_register_additional_checkout_field( array(
        'id'       => 'wpide/delivery-day',
        'label'    => 'Delivery day',
        'location' => 'order',
        'type'     => 'select',
        'required' => true,
        'options'  => $options,
    ) );
} );
```

## Notes

Needs WooCommerce 8.9 or newer with the Checkout block, and the chosen day appears on the order screen and in emails automatically.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Delivery Day Selector on the Block Checkout" 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/
