Skip to content
Docs
Get RestroPress

Filter

rpress_order_eta

Updated
On this page

Filters the expected arrival or ready time of an order.

Applied to the result of rpress_get_order_eta(). The array has timestamp (Unix time), label (a sentence such as "Arrives around 7:55 pm"), time (formatted time, with the date when it is not today), date (formatted date, '' for today) and asap (bool). The order details page reads time and asap and writes its own headings, so changing label does not change that page.

Available since RestroPress 3.5.1.

Parameters#

ParameterTypeDescription
$etaarrayKeys timestamp, label, time, date and asap.
$payment_idintOrder (payment) ID.

Return value#

array|null. The estimate with the same keys, or null for no estimate.

Example#

add_filter( 'rpress_order_eta', 'my_order_eta', 10, 2 );
function my_order_eta( $eta, $payment_id ) {
	if ( $eta['asap'] ) {
		$eta['time'] = sprintf( __( '%s (estimate)', 'my-plugin' ), $eta['time'] );
	}
	return $eta;
}

Notes#

Not applied when no time can be worked out; the function returns null first.

Source#

Applied in:

  • includes/features/checkout-flow/functions.php (line 305), in rpress_get_order_eta()

See also#

Was this page helpful?