Merge pull request #14483 from woocommerce/fix/14476

Adds a fallback to queue_transactional_email if background sending is disabled.
This commit is contained in:
Claudio Sanches 2017-04-18 18:29:33 -03:00 committed by GitHub
commit faaac6d67b
1 changed files with 10 additions and 5 deletions

View File

@ -102,13 +102,18 @@ class WC_Emails {
} }
/** /**
* Queue transactional email so it's not sent in current request. * Queues transactional email so it's not sent in current request if enabled,
* otherwise falls back to send now.
*/ */
public static function queue_transactional_email() { public static function queue_transactional_email() {
self::$background_emailer->push_to_queue( array( if ( is_a( self::$background_emailer, 'WC_Background_Emailer' ) ) {
'filter' => current_filter(), self::$background_emailer->push_to_queue( array(
'args' => func_get_args(), 'filter' => current_filter(),
) ); 'args' => func_get_args(),
) );
} else {
call_user_func_array( array( __CLASS__, 'send_transactional_email' ), func_get_args() );
}
} }
/** /**