Filter
rpress_service_hours_settings
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#
| Parameter | Type | Description |
|---|---|---|
$settings | array | Keys interval, prep_time, always_open, preorder, preorder_days, last_order_buffer and lead_time. |
$service | string | Service type, such as 'delivery' or 'pickup'. May be empty. |
$engine | RPRESS_Service_Hours | The 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), inRPRESS_Service_Hours::get_settings()
