woocommerce_allow_switching_email_locale │ хук-фильтр │ WC 6.8.0

Filter the ability to switch email locale.

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

add_filter( 'woocommerce_allow_switching_email_locale', 'wp_kama_woocommerce_allow_switching_email_locale_filter', 10, 2 );

/**
 * Function for `woocommerce_allow_switching_email_locale` filter-hook.
 * 
 * @param bool     $default_value The default returned value.
 * @param WC_Email $email         The WC_Email object.
 *
 * @return bool
 */
function wp_kama_woocommerce_allow_switching_email_locale_filter( $default_value, $email ){
	// filter...
	return $default_value;
}
$default_value(true|false)
The default returned value.
$email(WC_Email)
The WC_Email object.

Список изменений

С версии 6.8.0 Введена.

Где вызывается хук

WC_Email::setup_locale()
woocommerce_allow_switching_email_locale
woocommerce/includes/emails/class-wc-email.php 440
$switch_email_locale = apply_filters( 'woocommerce_allow_switching_email_locale', true, $this );

Где используется хук в WooCommerce

woocommerce/src/Internal/Email/DeferredEmailQueue.php 162
add_filter( 'woocommerce_allow_switching_email_locale', array( $this, 'switch_email_to_queued_locale' ), PHP_INT_MAX, 2 );
woocommerce/src/Internal/Email/DeferredEmailQueue.php 168
remove_filter( 'woocommerce_allow_switching_email_locale', array( $this, 'switch_email_to_queued_locale' ), PHP_INT_MAX );