0

I need some ideas how can I disable woocommerce customer invoice / order details email. This mail is manual, but I use WCFM vendor plugin, and when vendor changes the price in Pending status order, this email are sent to Customer.

In this documentation there are no hooks about this particular situation (https://woocommerce.com/document/unhookremove-woocommerce-emails/)

I found snippet https://www.businessbloomer.com/woocommerce-disable-customer-order-email-for-free-orders/ but it doesn't work when I change "===" to "<" (Client still gets the email)

Second solution (didn't worked):

remove_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger' ) );
gadzas
  • 1

2 Answers2

0

I've disabled the mail route in the past progammatically, perhaps this would suit this situation?

add_action( 'woocommerce_email', 'disableWCECPO' );

function disableWCECPO(WC_Emails $email_class ) {
    $email_class->emails['WC_Email_Customer_Processing_Order']->enabled = 'no';
}
Barrie Dawson
  • 244
  • 1
  • 5
  • Hi, it didn't work for me, then I tried changing 'WC_Email_Customer_Processing_Order' to 'WC_Email_Customer_Invoice' and still it didin't work. Sending documentation maybe someone would understand this: https://woocommerce.github.io/code-reference/classes/WC-Email-Customer-Invoice.html – gadzas Apr 05 '22 at 07:45
0
add_action('woocommerce_email_classes', 'disable_invoice', PHP_INT_MAX, 1);

function disable_invoice( $emails ) {

    unset($emails['WC_Email_Customer_Invoice']);
    return $emails;
}

This removes the invoice email from the list at line 221 in woocommerce/includes/class-wc-emails.php, so when the class is called nothing will happen (besides perhaps a php notice about calling a non-existent class depending on your config).

Tested and working on woo 7.3, wp 6.1.1, on both php 7.4 and 8.0