• Resolved tcdigital

    (@tcdigital)


    I’d like to disable the payment received email (Zahlung erhalten für Bestellung ***) for orders that only contain free products.

    I’ve already found the filter woocommerce_gzd_disable_gateways_paid_order_email, but that only applies to payment gateways. How can I disable these emails if no payment gateway was selected (due to the order being free)?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author vendidero

    (@vendidero)

    Hi there,

    did you try adding an empty item to the array? The payment method should be empty for a free order. I’ve just added an additional filter to improve that handling: https://github.com/vendidero/woocommerce-germanized/commit/f1d3faebedd530ebc8ece53cd7f02ebc2ef8d3b8

    The filter is called woocommerce_gzd_disable_paid_for_order_notification and has the order id as argument attached to it.

    Cheers

    Thread Starter tcdigital

    (@tcdigital)

    Thanks for the quick reply, the new filter could be really useful.

    Im going to try out an empty payment method, too.

    For the time being I’m using the woocommerce_email_recipient filter, which seems to work as well.

    
    add_filter( 'woocommerce_email_recipient_customer_paid_for_order', 'override_disable_customer_order_email_if_free', 10, 2 );
    function override_disable_customer_order_email_if_free( $recipient, $order ) {
        $page = $_GET['page'] = isset( $_GET['page'] ) ? $_GET['page'] : '';
        if ( 'wc-settings' === $page ) {
            return $recipient;
        }
    
        $order_total = floatval($order->get_total());
        if ($order_total == 0) {
            return "";
        }
    
        return $recipient;
    }
    
    Plugin Author vendidero

    (@vendidero)

    Hi there,

    alright, thanks for sharing your solution!

    Cheers

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Disable “Payment Received”-Mails for free orders’ is closed to new replies.