Skip to content
Docs
Get RestroPress

Action

rpress_before_service_time

Updated
On this page

Fires before the time selector of a service, so extensions can output a date selector.

Runs in the delivery and pickup templates and in the date and time popup, before the service time row. The output is captured with an output buffer. If the captured markup contains the id rpress_get_delivery_dates or rpress_get_pickup_dates, it is treated as a replacement date selector and the built-in date field is not printed; otherwise the markup is printed and the standard date field still appears.

Parameters#

ParameterTypeDescription
$servicestringService type being rendered, either delivery or pickup.

Example#

add_action( 'rpress_before_service_time', 'my_before_service_time' );
function my_before_service_time( $service ) {
	echo '<p class="my-service-note">' . esc_html( sprintf( __( 'Choose a %s slot below.', 'my-textdomain' ), $service ) ) . '</p>';
}

Notes#

The argument is a literal string in the delivery and pickup templates and a loop variable in the popup. Output is buffered, so return values are ignored.

Source#

Fired from:

  • templates/rpress-datetime-popup.php (line 148)
  • templates/rpress-delivery.php (line 45)
  • templates/rpress-pickup.php (line 45)

See also#

Was this page helpful?