skip to Main Content

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' ) );

2

Answers


  1. 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';
    }
    
    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search