Created
April 23, 2014 16:38
-
-
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/
This file contains hidden or 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
<?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 .= ', [email protected]'; | |
} | |
return $recipient; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment