Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinstern/11222722 to your computer and use it in GitHub Desktop.
Save justinstern/11222722 to your computer and use it in GitHub Desktop.
WooCommerce New Order email alert based on payment type. This snippet will send a new order alert email to an additional email address, based on payment type. Reader question from http://www.skyverge.com/blog/how-to-add-a-custom-woocommerce-email/
<?php
// Add everything below to your current theme's functions.php:
// The email to send can be changed by using a different filter in place of 'woocommerce_email_recipient_new_order'
// The payment method can be changed by using a different payment method id in place of 'cod'
add_filter( 'woocommerce_email_recipient_new_order', 'wc_new_order_cash_on_delivery_recipient', 10, 2 );
function wc_new_order_cash_on_delivery_recipient( $recipient, $order ) {
if ( 'cod' == $order->payment_method ) {
$recipient .= ', john@example.com';
}
return $recipient;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment