Automattic\WooCommerce\Internal\Email
DeferredEmailQueue::push
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.
Method of the class: DeferredEmailQueue{}
No Hooks.
Returns
true|false. True if the email was queued.
Usage
$DeferredEmailQueue = new DeferredEmailQueue(); $DeferredEmailQueue->push( $filter, $args ): bool;
- $filter(string) (required)
- The action hook name that triggered the email.
- $args(array) (required)
- The arguments passed to the action hook.
DeferredEmailQueue::push() DeferredEmailQueue::push code WC 10.9.1
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;
}