woogc/checkout/single/split/trigger_email
Name: woogc/checkout/single/split/trigger_email
Type: Filter
Arguments: $status, $args
By default, WooCommerce will send appropriate email messages for every order. That may not be required in certain scenarios, so better control over the sent messages is necessary. This filter helps to manage those email messages programmatically.
For example, when check-out products from two other shops, disable the emails for the main order on the check-out:
add_filter ( 'woogc/checkout/single/split/trigger_email', '__suppress_emails_for_main_order', 10, 2 ); function __suppress_emails_for_main_order( $status, $args ) { if ( $args['is_split_order'] === FALSE ) $status = FALSE; return $status; }
In the following example, the Customer receives email messages for the main order but not the split orders. The admin shops where a split order is created, continue to receive the new order message.
add_filter ( 'woogc/checkout/single/split/trigger_email', '__enabled_emails_for_main_order', 10, 2 ); function __enabled_emails_for_main_order( $status, $args ) { //allow admin e-mails to get through if ( strpos( $args['email_object']->template_html, 'admin-' ) !== FALSE ) return $status; if ( $args['is_split_order'] === TRUE ) $status = FALSE; return $status; }
The code should be placed inside a PHP file on /wp-content/mu-plugins folder.