Skip to content
Docs
Get RestroPress

Filter

rpress_is_preorder_enabled

Updated
On this page

Filters whether pre-orders are enabled for a service type.

Computed from the pre-order timing settings for the given service. The result is cast to a boolean. Return false to prevent customers from choosing a future date for that service.

Parameters#

ParameterTypeDescription
$enabledboolWhether pre-orders are enabled according to the settings.
$service_typestringService slug, such as delivery or pickup.

Return value#

bool. Whether pre-orders are enabled.

Example#

function my_preorder_enabled( $enabled, $service_type ) {
	if ( 'delivery' === $service_type ) {
		return false;
	}
	return $enabled;
}
add_filter( 'rpress_is_preorder_enabled', 'my_preorder_enabled', 10, 2 );

Source#

Applied in:

  • includes/rp-core-functions.php (line 354), in rpress_is_preorder_enabled()
Was this page helpful?