Support » Plugin: WooCommerce » Failed and Canceled orders Email send to Customer

  • Resolved VitaSerk

    (@serkankurnaz)


    Hello,

    I want to send the emails, that i get as an admin only, if a order is canceled or has failed ALSO SEND TO MY CUSTOMER, so he knows that the order needs to be paid again.

    It seems, that it is only possible to send those email to the admins? How can i fix this?
    I want ONLY the customer to get an email, not the admin.
    Is there a workaround? I saw some function.php code editing on google, but I do not know anything about it 🙁

    So could you please tell me, how and where exactly I can add something, so those 2 emails (failed and canceled) are send ONLY to the customer and not the admin. If that is not possible, I want to send them to both. So the customer gets 100% an email notifcactions.

    It is the 2nd and 3rd option, https://imgur.com/6nkEm4c

    I also saw some plug-in, but it seems they dont work really good with the new updates 5.3 and 3.8.1 🙁

    Thanks a lot for any help!

    The page I need help with: [log in to see the link]

Viewing 15 replies - 16 through 30 (of 30 total)
  • fususu

    (@fususu)

    I also wonder how to send to customer only, not admin. Finally I came up with this simple solution, just send an email to customer by wp_mail function when the order status has changed. Hope it help someone!

    add_action('woocommerce_order_status_changed', 'send_cancel_email_to_customer_fususu', 10, 4);
    function send_cancel_email_to_customer_fususu($order_id, $old_status, $new_status, $order){
        $headers = array('Content-Type: text/html; charset=UTF-8');
        $subject = 'Your order #'.$order_id.' has been cancelled';
        $message = '<p>Thank you,</p>';
        $message .='<p>Just a friendly inform that your order has been cancelled due to some reasons.</p>';
        $message .='<p>See you on the next order!</p>';
        if ( $new_status == 'cancelled' || $new_status == 'failed' ){
            $customer_email = $order->get_billing_email(); // get the customer email
            wp_mail($customer_email, $subject, $message, $headers );
        } 
    }
    • This reply was modified 2 years ago by fususu.

    @fususu hello, where to place that code?

    thanks

    @deniby you put it in functions.php file in the theme folder.

    @serkankurnaz how have you tested if Failed Order email literally is sent to the customer? TIA

    @serkankurnaz hi bro does this code still works? i did as you said but no success

    Thread Starter VitaSerk

    (@serkankurnaz)

    hey everyone,

    yes it still works!

    You either put it into functions.php file in the theme folder or you can also use the plug in code snippets for example.

    Just paste it there and you are good 🙂

    You can easily test it with a test order and a test customer email.

    @serkankurnaz i use the code snippers plug-in and paste the code that you mentioned earlier but i did not work for me 🙁 ant help will be much appreciate

    Thread Starter VitaSerk

    (@serkankurnaz)

    @sharyar8686

    here is the code i use:
    https://imgur.com/Zl8ONrr

    + you have to activate the Failed and Canceled orders Email in woo settings!
    https://imgur.com/4p3hr6Y

    Hope it works!

    @serkankurnaz
    I am following the same:
    in woo setting the emails are activated
    https://imgur.com/SHprdcr
    thats my code same as your
    https://imgur.com/NIxdodR

    P.S are you using any email customizer plugin? i am using email customizer for woo

    Thread Starter VitaSerk

    (@serkankurnaz)

    @sharyar8686

    looks good, you should test it on stagin site with ALL other plug ins deactivated…

    I am using kadence email designer 🙂 it is free and works, but i doubt it has to do anything with not sendung the mail.

    Oh you should also use WP SMPT Plug-In to configure your mails propper.

    @serkankurnaz

    yes i am using the same plug-in kadence email customizer. and yes i have set up WP mail SMTP plugin and one other WP Mail Logging log to see if my mails are delivered or failed:
    now check this:
    https://imgur.com/IsGO2N0
    the last 2 emails is send to me and the customer and the top email send to me on cancellation but not to customer 🙁
    this means the function is not working upon order status change it it had worked the email should have trigger even if it fails.

    Thread Starter VitaSerk

    (@serkankurnaz)

    @sharyar8686 interesting…as said check it out on the staging site with all deativated and you should find the issue 🙂

    @serkankurnaz no success so far sill stuck even after deactivating all plug-ins except woo ,snippet and kadence

    Hi everyone,

    Personnaly @fususu code worked !

    I use Sendinblue SMTP… that may be the issue for @serkankurnaz solution…

    Thank you internet heros ! (:

    rainerd

    (@coresince84)

    The code from @serkankurnaz works but I have one issue with the mail sent to the customer: The “reply to” address is also the customer email and not the admin/shop mail which it should be… Anybody else having that issue?

Viewing 15 replies - 16 through 30 (of 30 total)
  • The topic ‘Failed and Canceled orders Email send to Customer’ is closed to new replies.