MainWP Community

Disable customer orders emails for free orders in WooCommerce

Disable customer orders emails for free orders in WooCommerce on your child site.

Snippet Type

Execute on Child Sites

Snippet

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 '';
    }
}