Remove code which expands/changes objects in emails
This commit is contained in:
parent
f8466cf61b
commit
9d5aee2c73
|
@ -92,17 +92,8 @@ class WC_Emails {
|
|||
* Queue transactional email via cron so it's not sent in current request.
|
||||
*/
|
||||
public static function queue_transactional_email() {
|
||||
$filter = current_filter();
|
||||
$args = func_get_args();
|
||||
|
||||
// Remove objects and store IDs.
|
||||
if ( 0 === strpos( $filter, 'woocommerce_order_status_' ) ) {
|
||||
$args[1] = $args[1]->get_id();
|
||||
} elseif ( 'woocommerce_low_stock' === $filter || 'woocommerce_no_stock' === $filter ) {
|
||||
$args[0] = $args[0]->get_id();
|
||||
} elseif ( 'woocommerce_product_on_backorder' === $filter ) {
|
||||
$args[0]['product'] = $args[0]['product']->get_id();
|
||||
}
|
||||
$filter = current_filter();
|
||||
$args = func_get_args();
|
||||
|
||||
wp_schedule_single_event( time() + 5, 'woocommerce_send_queued_transactional_email', array(
|
||||
'filter' => $filter,
|
||||
|
@ -121,16 +112,6 @@ class WC_Emails {
|
|||
public static function send_queued_transactional_email( $filter = '', $args = array() ) {
|
||||
if ( apply_filters( 'woocommerce_allow_send_queued_transactional_email', true, $filter, $args ) ) {
|
||||
self::instance(); // Init self so emails exist.
|
||||
|
||||
// Expand objects from IDs.
|
||||
if ( 0 === strpos( $filter, 'woocommerce_order_status_' ) ) {
|
||||
$args[1] = wc_get_order( $args[1] );
|
||||
} elseif ( 'woocommerce_low_stock' === $filter || 'woocommerce_no_stock' === $filter ) {
|
||||
$args[0] = wc_get_product( $args[0] );
|
||||
} elseif ( 'woocommerce_product_on_backorder' === $filter ) {
|
||||
$args[0]['product'] = wc_get_product( $args[0]['product'] );
|
||||
}
|
||||
|
||||
do_action_ref_array( $filter . '_notification', $args );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue