Code-Snippets-Functions/Execute a function on a child site/WooCommerce/disable-customer-order-email-for-free-orders.txt
2021-01-14 22:06:31 -07:00

11 lines
327 B
Text

add_filter('woocommerce_email_recipient_new_order', 'restrict_admin_new_order_mail', 1, 2);
function restrict_admin_new_order_mail( $recipient, $order ) {
if ( ! is_a( $order, 'WC_Order' ) )
return $recipient;
if( $order->get_total() > 0 ) {
return $recipient;
} else {
return '';
}
}