Cancel Order
-
Hello,
If the order is canceled, I want to send an e-mail to the customer and an e-mail address I specified ([email protected] in the example). However, this e-mail should not be received by the administrator (admin). So, it should only take the email address and customer it specifies. I wrote a code like the one below. However, he is still receiving an admin email notification. Can you help me ?function send_custom_email_notifications( $order_id, $old_status, $new_status, $order ){ if ( $new_status == 'cancelled' || $new_status == 'failed' ){ $wc_emails = WC()->mailer()->get_emails(); // Get all WC_emails objects instances $customer_email = $order->get_billing_email(); // The customer email $order_info_email = '[email protected]'; } if ( $new_status == 'cancelled' ) { // change the recipient of this instance $wc_emails['WC_Email_Cancelled_Order']->recipient = ''; $wc_emails['WC_Email_Cancelled_Order']->recipient = $customer_email.',' . $order_info_email; // Sending the email from this instance $wc_emails['WC_Email_Cancelled_Order']->trigger( $order_id ); }}
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Cancel Order’ is closed to new replies.