Automattic\WooCommerce\Internal\Email

DeferredEmailQueue::push │ public │ WC 1.0

Add an email callback to the queue.

Returns false when any argument cannot be represented in Action Scheduler storage, allowing callers to fall back to sending the email synchronously.

Метод класса: DeferredEmailQueue{}

Хуков нет.

Возвращает

bool. True if the email was queued.

Использование

$DeferredEmailQueue = new DeferredEmailQueue();
$DeferredEmailQueue->push( $filter, $args ): bool;
$filter(строка) (обязательный)
The action hook name that triggered the email.
$args(массив) (обязательный)
The arguments passed to the action hook.

Код DeferredEmailQueue::push() WC 11.2.2

public function push( string $filter, array $args ): bool {
	try {
		$args = $this->prepare_arg_for_queue( $args );
	} catch ( \UnexpectedValueException $e ) {
		return false;
	}

	$this->queue[] = array(
		'filter' => $filter,
		'args'   => $args,
	);

	if ( ! $this->shutdown_registered ) {
		add_action( 'shutdown', array( $this, 'dispatch' ), 100 );
		$this->shutdown_registered = true;
	}

	return true;
}