0
votes

My Woocommerce shop allows to buy for anonymous customers without email address. One of allowed payment method is online card payment. I added blind copy to notification mail to allow admin know about payment:

add_filter('woocommerce_email_headers', function ($header, $email_id, $order) {
    if ('customer_processing_order' === $email_id) {
        $header .= "BCC: MyShopAdmin <[email protected]>";
    }
    return $header;
}, 10, 3);

Works great when customer entered email during checkout process.

None of email when customer not entered email address. Yes, it's reasonable - no email address = no email.

But I want to inform shop admin about successful payment even no customer email address entered. How to do it?

Guess exists some point in Woocommerce where I can analyze email headers early before mail send init. I did not find any hooks / filters for that. Does anybody can help me?

1

1 Answers

0
votes

instead of adding filter at woocommerce_email_headers why dont you try woocommerce_payment_complete hook

This would facilitate shop admin about successful payment event

add_action( 'woocommerce_payment_complete', 'payment_complete' );