• Resolved ritual45

    (@ritual45)


    Hello. I don’t know why, but my website stopped sending Failed Order emails for admin. I tried to make a code, which can send this mail, but it still won’t send. Maybe anyone can help me? Maybe it is something bad in my code?

    Code:

    add_action('woocommerce_admin_failed_order_changed', 'admin_failed_order_email_notifications', 10, 4 );
    function admin_failed_order_email_notifications( $order_id, $old_status, $new_status, $order ){
        // Only when order status is changed to 'cancelled'
        if ( $new_status != 'failed' ) return;
    
        // Send cancelled email notification
        WC()->mailer()->get_emails()['WC_Email_Failed_Order']->trigger( $order_id ); 
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @ritual45

    Thanks for reaching out!

    I understand that the Failed Order Email is not being sent to your site’s admin, correct?

    As a first step, please check that the Failed Order email is enabled under WooCommerce > Settings > Emails.

    Furthermore, please see that the settings for this email are also correct.

    If yes, for us to investigate this further, can you please try to switch to the default Storefront theme and only WooCommerce plugin is enabled, create a test order and change its status to Failed and see if you receive the Failed Order Email afterwards?

    If so, then this kind of problem is usually caused by your theme or a third-party plugin present on your site. We can run a conflict test to verify this. I’d recommend cloning your site to a staging environment and performing the tests described on this guide without modifying your live site or impacting customers. Many hosts provide staging facilities, so it’s worth checking in with them. It’s also possible to do it using the free WP Staging plugin.

    If this was caused by a third-party plugin present on your site, it would be best to reach out to the developers for further assistance here.

    If this did not resolve the issue, please share your System Status Report, that will help us further troubleshoot.

    You can find it via WooCommerce > Status. Select Get system report and then Copy for support. Once you’ve done that, you can paste it into your reply here.

    If you could also provide the fatal error logs (if any) under WooCommerce > Status > Logs.

    You could copy and paste your reply here or paste it via https://gist.github.com/ and send the link here.

    Let us know how it goes!

    Hi @ritual45

    We haven’t heard back from you in a while, so I’m going to go ahead and mark this thread as resolved. If you have any other questions please start a new topic.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to force Failed mail sending for admin?’ is closed to new replies.