Skip to content
Docs
Get RestroPress

Filter

rpress_is_store_open

Updated
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#

ParameterTypeDescription
$is_openboolWhether the store is open according to the built-in hours.
$service_typestringService type being checked, such as delivery or pickup.
$selected_datestringDate being checked, formatted Y-m-d.
$current_timeintCurrent time as a Unix timestamp.
$open_timeint|falseOpening time for the selected date as a timestamp, or false when closed all day or unset.
$close_timeint|falseClosing 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), in rpress_is_store_open()

See also#

Was this page helpful?