WC_Emails::send_transactional_email
Init the mailer instance and call the notifications for the current filter.
Method of the class: WC_Emails{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$result = WC_Emails::send_transactional_email( $args );
- $args(array)
- Email args .
Default:[])
WC_Emails::send_transactional_email() WC Emails::send transactional email code WC 10.5.0
public static function send_transactional_email( $args = array() ) {
try {
$args = func_get_args();
self::instance(); // Init self so emails exist.
/**
* Action hook for email template classes to trigger the sending of an email.
*
* The name of the hook is based on the "parent" hook that is currently firing, that this is attached to.
* See the WC_Emails::init_transactional_emails method for a list of hooks.
*
* @since 3.1.0
*
* @param array $args Args from the parent hook, which may differ depending on the hook.
*/
do_action_ref_array( current_filter() . '_notification', $args );
} catch ( Exception $e ) {
$error = 'Transactional email triggered fatal error for callback ' . current_filter();
$logger = wc_get_logger();
$logger->critical(
$error . PHP_EOL,
array(
'source' => 'transactional-emails',
)
);
if ( Constants::is_true( 'WP_DEBUG' ) ) {
trigger_error( esc_html( $error ), E_USER_WARNING ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
}
}
}