• Resolved slimmyweight

    (@slimmyweight)


    Hi I have already looked at this thread:
    https://www.ads-software.com/support/topic/failed-and-canceled-orders-email-send-to-customer/

    According to that thread it seems that if a customers payment/order has failed the only way to get the failed email to be sent to a customer is through code, is that correct?

    And if this is the case I can’t find a way of testing it, if even when I get someone to help me change the code to see if the emails are being sent to my customers instead of my admin email correctly. Because the only way it will be triggered for testing is when someone actually fails to pay for their order, is there a way of testing this?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @slimmyweight,

    Please add this snippet to your theme’s functions.php file

    function wdc_send_calceled_order_email_to_customer( $recipient, $order ){
        // Get billing email from order object
        $billing_email = $order->get_billing_email();
    
        return $recipient . ', ' . $billing_email;
    }
    // This adds customer email for canceled orders
    add_filter( 'woocommerce_email_recipient_cancelled_order', 'wdc_send_calceled_order_email_to_customer', 10, 2 );
    
    // This adds customer email for failed orders
    add_filter( 'woocommerce_email_recipient_failed_order', 'wdc_send_calceled_order_email_to_customer', 10, 2 );

    The easiest way to test it is to enable BACS or COD payment methods and create a sample order. The status of that order will be “On Hold”, you can then change the order status manually from On Hold to Failed and you should get the email and the customer should. To test again change the status again to on hold and then to Cancelled.

    P.S. After changing the status you should click on the Update button,

    • This reply was modified 3 years, 5 months ago by Stefan Vasiljevic. Reason: code formatting
    Mirko P.

    (@rainfallnixfig)

    Hi @slimmyweight,

    A way of testing failed emails notifications sent to the customer would be installing WP Mail Logging that will log all emails sent by WordPress. You can download the plugin from this URL:

    https://www.ads-software.com/plugins/wp-mail-logging/

    There are a few ways to test payments in WooCommerce. Here are some articles that will walk you through that.

    https://quadlayers.com/test-woocommerce-orders/
    https://wpdatatables.com/woocommerce-test-mode/

    Hope this was helpful to you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘sending failed order emails to customers and testing those emails are being sent’ is closed to new replies.