Filter
rpress_is_store_open
On this page
Filters whether the store is open for a service type and date.
Runs at the end of rpress_is_store_open(), after the open/close window, always-open setting, overnight hours and pre-order rules have been applied. Return a boolean to force the store open or closed. The time values are Unix timestamps in the site timezone; $open_time and $close_time are false when the day is closed or no valid hours are set.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$is_open | bool | Whether the store is open according to the built-in hours. |
$service_type | string | Service type being checked, such as delivery or pickup. |
$selected_date | string | Date being checked, formatted Y-m-d. |
$current_time | int | Current time as a Unix timestamp. |
$open_time | int|false | Opening time for the selected date as a timestamp, or false when closed all day or unset. |
$close_time | int|false | Closing time for the selected date as a timestamp, or false when closed all day or unset. |
Return value#
bool. True if the store is open, false if closed.
Example#
function my_close_store_on_kitchen_outage( $is_open, $service_type, $selected_date, $current_time, $open_time, $close_time ) {
if ( 'delivery' === $service_type && get_option( 'my_kitchen_outage' ) ) {
return false;
}
return $is_open;
}
add_filter( 'rpress_is_store_open', 'my_close_store_on_kitchen_outage', 10, 6 );
Notes#
The Store Timing extension overrides rpress_is_store_open() entirely when active, in which case this filter may not run.
Source#
Applied in:
includes/rp-core-functions.php(line 2988), inrpress_is_store_open()
See also#
Was this page helpful?
