Skip to content

Instantly share code, notes, and snippets.

@filipecsweb
Created November 6, 2015 02:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save filipecsweb/446b7fef4c967c473a95 to your computer and use it in GitHub Desktop.
Save filipecsweb/446b7fef4c967c473a95 to your computer and use it in GitHub Desktop.
Stop sending "processing order" e-mail when WooCommerce order status changes from pending to on-hold
<?php
/**
* Disable action that sends e-mail to customer, warning that his/her order is processing,
* as this is not true, because when the status changes from pending to on-hold,
* the order is not processing yet.
*
* @return void
*/
function manipulate_woocommerce_email_sending($email_class){
remove_action('woocommerce_order_status_pending_to_on-hold_notification', array($email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger'));
add_action('woocommerce_order_status_on-hold_to_processing_notification', array($email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger'));
}
add_action('woocommerce_email', 'manipulate_woocommerce_email_sending');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment