Slotline documentation1.x
Developers

Filters and hooks

Change the first bookable date, close dates, skip the date for some carts, and build add-ons with Slotline's schedule, slot and settings hooks.

Slotline's hooks let a theme or plugin change which dates customers can book, and let add-ons (such as Slotline Pro) add schedules, slot fields and settings. Add the code to a small plugin or your child theme's functions.php.

Dates

slotline_earliest_date

The first date customers can choose, as Y-m-d in the store's time zone. Return the later of your date and the one passed in, so other plugins' limits still apply.

// Nothing before the shop reopens on March 2.
add_filter( 'slotline_earliest_date', function ( $date, $type, $products ) {
	$reopen = '2027-03-02';
	return ( '' === $date || $reopen > $date ) ? $reopen : $date;
}, 10, 3 );

$type is delivery or pickup; $products is the product IDs being booked, or null for the cart's.

slotline_closed_dates

More dates nobody can book, on top of the closed dates in the settings. Same arguments.

add_filter( 'slotline_closed_dates', function ( $dates ) {
	$dates[] = '2027-04-18'; // The van's annual service.
	return $dates;
} );

slotline_needs_date

Whether the cart asks for a date at all (true, $type). Return false to skip it, e.g. for a cart that only holds gift cards that still ship.

slotline_now

The current time Slotline uses (a timestamp). Useful in tests.

Statuses and labels

Orders take a place in their slot unless they're cancelled, failed, refunded or an unfinished Checkout block draft. The date and slot show through WooCommerce's woocommerce_get_order_item_totals (row key slotline), so you can move or restyle that row with the same filter at a later priority.

Building an add-on

Slotline fires slotline_loaded once it has loaded (on plugins_loaded, only when WooCommerce is active). Hook your features there; SLOTLINE_VERSION tells you which Slotline you're running with.

Hook Use
slotline_schedules Add schedule keys to ['delivery']. A schedule's settings are options slotline_{key}_{field}, like delivery's, and Slotline offers and books it like its own
slotline_schedule_type, slotline_schedule_name The type (delivery or pickup) and the name of your schedule ($value, $key)
slotline_schedule_defaults Default settings by type ($defaults, $type)
slotline_cart_schedule The schedule the cart books ($key, $type, $rate): Slotline passes delivery, or '' for a pickup
slotline_slot Read your own field from a saved slot row ($slot, $row)
slotline_slot_columns Add a column to the time slots table ($columns, $option_id): key => [ 'label' => …, 'cell' => callable( $name, $slot ), 'desc' => … ]
slotline_save_slot Save your column ($row, $posted)
slotline_slot_notes Notes after a slot at checkout, e.g. "+$5.00" ($notes, $slot, $schedule)
slotline_settings The settings fields; Extendiment\Slotline\Admin\SettingsSection::schedule_fields( $key, $title ) builds a schedule's section
slotline_checkout_booked Action: the cart's choice was booked on its new order ($order, $schedule, $date, $slot)
slotline_booking_changed Action: the store changed an order's booking on the order screen ($order, $before)

The booking is order meta: _slotline_type, _slotline_date (Y-m-d), _slotline_slot (e.g. 09:00-12:00, empty for a date only) and _slotline_schedule (only for a schedule that isn't the type's own). Read it with Extendiment\Slotline\Bookings; Bookings::between( $from, $to ) finds booked orders and works with both order storages.