Automattic\WooCommerce\Internal\Email
DeferredEmailQueue::switch_email_to_queued_locale
Switch an email that is not sent to the customer to the queued locale, from WC_Email::setup_locale().
Hooked last, so an email whose locale switching was turned off, e.g. by a translation plugin, is left alone.
Method of the class: DeferredEmailQueue{}
No Hooks.
Returns
mixed. The unchanged $allow.
Usage
$DeferredEmailQueue = new DeferredEmailQueue(); $DeferredEmailQueue->switch_email_to_queued_locale( $allow, $email );
- $allow(mixed) (required)
- Whether the email may switch its locale.
- $email(mixed) (required)
- The email being set up.
DeferredEmailQueue::switch_email_to_queued_locale() DeferredEmailQueue::switch email to queued locale code WC 11.3.0
public function switch_email_to_queued_locale( $allow, $email ) {
if ( ! $allow || ! $email instanceof \WC_Email || $email->is_customer_email() ) {
return $allow;
}
if ( switch_to_locale( $this->sending_locale ) ) {
$this->switched_emails[] = spl_object_id( $email );
\WC()->load_plugin_textdomain();
}
return $allow;
}