1

By default, Woocommerce sends out the New Order email as soon as the order is placed. Due to credit card processing and fraud control, this is messing up our order processing flow. We need to prevent the New Order emails from being sent until the order status changes to complete.

Any solid solutions for this?

A.Boone
  • 11
  • 2
  • Oud of curiosity, what was your order processing flow? "messing up our order processing flow" order confirmation email should be sent anyways, no? the text of the email could explain the order is being processed and a nother email will be sent when xyz has been done e.g. shipped, built, job done etc. – Mohammed Joraid Dec 01 '20 at 06:52

3 Answers3

0

You can simply disable the mail from Admin >> Woocommerce >> Settings >> Emails then disable Processing order email by clicking manage button.

user8083042
  • 45
  • 10
  • That will prevent the email from sending completely. Better to send it later after the order is complete: https://stackoverflow.com/a/66174752/1319778 – SolaceBeforeDawn Jan 02 '23 at 21:38
0

Rather that preventing the "New Order" email from being sent, simply send it only after payment has completed.

This answer should be helpful: https://stackoverflow.com/a/66174752/1319778

  1. First unhook all the New Order emails:

     /**
     * Unhook and remove WooCommerce all default "New Order" emails.
     */
    
     add_action( 'woocommerce_email', 'unhook_those_pesky_emails' );
      function unhook_those_pesky_emails( $email_class ) {
      // New order emails
      remove_action( 
     'woocommerce_order_status_pending_to_processing_notification', array( 
     $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
     remove_action( 
     'woocommerce_order_status_pending_to_completed_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
     remove_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
     remove_action( 'woocommerce_order_status_failed_to_processing_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
     remove_action( 'woocommerce_order_status_failed_to_completed_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
     remove_action( 'woocommerce_order_status_failed_to_on-hold_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
      }
    
  2. then add the trigger to send the email

       /** 
       * trigger "New Order" email on "completed" status
       */
    
       add_action( 'woocommerce_order_status_completed', 
         'process_new_order_notification', 20, 2 );
         function process_new_order_notification( $order_id, $order ) {
         // Send "New Email" notification (to admin)
         WC()->mailer()->get_emails()['WC_Email_New_Order']->trigger( $order_id 
      );
      }
    
  3. You also still need to "enable" the new order email type in the woo backend email settings, but it will not send unless the above conditions are met.

SolaceBeforeDawn
  • 958
  • 1
  • 8
  • 16
-1

You can consider using FraudLabs Pro Fraud Prevention plugin for WooCommerce. You can create a validation rule to always on hold the new order for review. Once you confirmed with the payment, you can either change the order status on WooCommerce or click the "Approve" button on the plugin to complete the ordering process.

Chris Lim
  • 424
  • 4
  • 9