Created
July 20, 2014 21:48
-
-
Save twoelevenjay/657720679664e9651199 to your computer and use it in GitHub Desktop.
Function to have WooCommerce send an automatic heads up email to the shop owner for orders that switch to a status of on-hold.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('woocommerce_order_status_changed', 'send_hold_email'); | |
function send_hold_email($order_id) { | |
$order_data = new WC_Order($order_id); | |
if ($order_data->status=='on-hold') { | |
global $woocommerce; | |
$mailer = $woocommerce->mailer(); | |
$message = $mailer->wrap_message( | |
__( 'Order placed On-hold', 'woocommerce' ), | |
sprintf( __( 'Order %s has been marked as on-hold. Reason: %s', 'woocommerce' ), $order_data->get_order_number(), $posted['reason_code'] ) | |
); | |
$mailer->send( get_option( 'admin_email' ), sprintf( __( 'Order %s placed On-hold', 'woocommerce' ), $order_data->get_order_number() ), $message ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment