woocommerce_email_log_context filter-hookWC 10.9.0

Filter the context array logged for each transactional email attempt.

Usage

add_filter( 'woocommerce_email_log_context', 'wp_kama_woocommerce_email_log_context_filter', 10, 3 );

/**
 * Function for `woocommerce_email_log_context` filter-hook.
 * 
 * @param array    $context  The context array to be logged.
 * @param string   $email_id The email type ID.
 * @param WC_Email $email    The WC_Email instance.
 *
 * @return array
 */
function wp_kama_woocommerce_email_log_context_filter( $context, $email_id, $email ){

	// filter...
	return $context;
}
$context(array)
The context array to be logged.
$email_id(string)
The email type ID.
$email(WC_Email)
The WC_Email instance.

Changelog

Since 10.9.0 Introduced.

Where the hook is called

EmailLogger::handle_woocommerce_email_sent()
woocommerce_email_log_context
EmailLogger::log_non_send_outcome()
woocommerce_email_log_context
woocommerce/src/Internal/Email/EmailLogger.php 122
$context = (array) apply_filters( 'woocommerce_email_log_context', $context, $email_id, $email );
woocommerce/src/Internal/Email/EmailLogger.php 283
$context = (array) apply_filters( 'woocommerce_email_log_context', $context, $email_id, $email );

Where the hook is used in WooCommerce

woocommerce/src/Internal/Admin/EmailPreview/EmailPreviewRestController.php 305
add_filter( 'woocommerce_email_log_context', $mark_as_test );
woocommerce/src/Internal/Admin/EmailPreview/EmailPreviewRestController.php 309
remove_filter( 'woocommerce_email_log_context', $mark_as_test );