0
votes

I'm currently trying to send an email to my customer after he paid for an order but the email don't gets sent:

add_filter( 'woocommerce_payment_complete_order_status', 'update_order_status', 10, 2 );
function update_order_status( $order_status, $order_id ) {

    do_action( 'woocommerce_order_status_pending_to_processing_notification', $order_id );


    return 'completed';
}

I need to do this because I want to send the invoice and the payment notification email which is adapted to this filter.

The email I need to send

But when I complete an order the email dont gets sent.

The E-Mail I need to sent is activated in the WooCommerce settings:

enter image description here

1

1 Answers

0
votes

Order completed status come so you need to use woocommerce_order_status_completed filter.

function woocommerce_order_status_completed_email( $order_id ) {
  // here add your email code.

}
add_action( 'woocommerce_order_status_completed', 'woocommerce_order_status_completed_email', 10, 1 );

This will work for you.