Skip to content
Docs
Get RestroPress

Filter

rpress_service_hours_settings

Updated
On this page

Filters the settings the store hours engine uses for a service.

Applied by RPRESS_Service_Hours::get_settings(). The array holds interval (minutes between slots), prep_time (minutes), always_open, preorder, preorder_days, last_order_buffer (minutes before each window closes when new orders stop) and lead_time (minimum minutes before the first slot, used when longer than prep_time). The values drive open checks, slot generation and bookable dates. Use $engine->get_location_id() to vary them by branch.

Available since RestroPress 3.5.

Parameters#

ParameterTypeDescription
$settingsarrayKeys interval, prep_time, always_open, preorder, preorder_days, last_order_buffer and lead_time.
$servicestringService type, such as 'delivery' or 'pickup'. May be empty.
$engineRPRESS_Service_HoursThe engine asking for the settings.

Return value#

array. Settings in the same shape.

Example#

add_filter( 'rpress_service_hours_settings', 'my_service_hours_settings', 10, 3 );
function my_service_hours_settings( $settings, $service, $engine ) {
	if ( 'delivery' === $service && 12 === $engine->get_location_id() ) {
		$settings['last_order_buffer'] = 30;
		$settings['lead_time']         = 90;
	}
	return $settings;
}

Notes#

Changed in 3.5.1: the engine is passed as a new third argument, and the array gained the last_order_buffer and lead_time keys (both 0 by default, cast to non-negative integers after the filter). The other values are not re-checked after filtering. The filter runs many times per request, so keep callbacks fast.

Source#

Applied in:

  • includes/features/slot-engine/class-rpress-service-hours.php (line 253), in RPRESS_Service_Hours::get_settings()

See also#

Was this page helpful?