Skip to content

Instantly share code, notes, and snippets.

@paulotruta
Forked from filipecsweb/functions.php
Created September 23, 2018 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulotruta/444e33597999f310b27a6aa2e5bed4d6 to your computer and use it in GitHub Desktop.
Save paulotruta/444e33597999f310b27a6aa2e5bed4d6 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