Hooks and filters for customising Delivery Slots behaviour in your theme or a custom plugin.
Action Hooks
dslots_before_date_picker
Fires immediately before the delivery date picker is rendered on checkout. Use it to output custom HTML above the picker.
add_action( 'dslots_before_date_picker', function() {
echo 'Please choose your preferred delivery date:
';
} );
dslots_after_date_picker
Fires immediately after the delivery date picker on checkout. Use it to output custom HTML below the picker.
add_action( 'dslots_after_date_picker', function() {
echo 'Deliveries are made between 8am and 6pm.
';
} );
Filter Hooks
dslots_disabled_dates
Filters the array of disabled dates passed to the date picker. Add custom dates to block them from selection.
add_filter( 'dslots_disabled_dates', function( $dates ) {
// Block a specific date
$dates[] = '2024-12-26';
return $dates;
} );
dslots_slot_fee (PRO)
Filters the fee amount for a specific time slot before it is added to the order total. Receives the fee amount and the slot ID.
add_filter( 'dslots_slot_fee', function( $fee, $slot_id ) {
// Double the fee for slot ID 3
if ( 3 === $slot_id ) {
$fee = $fee * 2;
}
return $fee;
}, 10, 2 );
Order Meta Keys
The plugin stores the customer’s selections as order meta:
- _dslots_delivery_date — the selected delivery date in
Y-m-dformat. - _dslots_time_slot — (PRO) the selected time slot label or ID.
$delivery_date = get_post_meta( $order_id, '_dslots_delivery_date', true );
$time_slot = get_post_meta( $order_id, '_dslots_time_slot', true );