Skip to content
Docs
Get RestroPress

Filter

rpress_order_auto_accept_delay

Updated
On this page

Filters the delay in seconds before a new order is automatically accepted.

Runs when an order is queued for auto-accept: after a payment is inserted, or when its status changes to publish or complete, and only when the 'Order Auto Accepted' setting is on. The default is 2 seconds. The result is cast to an integer and clamped to a minimum of 0, then used as the offset for a single scheduled event on the rpress_order_auto_accept_scheduled hook.

Parameters#

ParameterTypeDescription
$delayintThe default delay in seconds (2).
$payment_idintThe payment (order) ID.
$payment_dataarrayPayment data from the insert action, or an array with the new 'status' when triggered by a status change.

Return value#

int. Delay in seconds before the order is accepted.

Example#

add_filter( 'rpress_order_auto_accept_delay', 'my_auto_accept_delay', 10, 3 );
function my_auto_accept_delay( $delay, $payment_id, $payment_data ) {
	if ( 'cash_on_delivery' === rpress_get_payment_gateway( $payment_id ) ) {
		return 60;
	}
	return $delay;
}

Notes#

Scheduling uses WP-Cron, so the actual acceptance time depends on when cron runs.

Source#

Applied in:

  • includes/payments/functions.php (line 264), in rpress_maybe_schedule_order_auto_accept()

See also#

Was this page helpful?