• Resolved Caoba

    (@caoba)


    Hello,

    I want to use the following code to remove the cash on delivery payment method payment instructions in some custom emails, but for this I need to know the Email ID, how can I get it?

    add_action( 'woocommerce_email_before_order_table', 'action_email_before_order_table_callback', 9, 4 );
    function action_email_before_order_table_callback( $order, $sent_to_admin, $plain_text, $email ){
        $payment_method = $order->get_payment_method();
    
        // Targeting "COD" payment method on Customer completed order email notification
        if ( 'customer_completed_order' === $email->id && 'cod' === $payment_method ) {
            $available_gateways = WC()->payment_gateways->get_available_payment_gateways();
    
            remove_action( 'woocommerce_email_before_order_table', [ $available_gateways[$payment_method], 'email_instructions' ], 10 );
        }
    }

    I could also use to remove it from all emails, but I don’t know how to modify the code for that.

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support angelagrey

    (@angelagrey)

    Hi,

    Thank you for reaching out to us.

    Email ID is the types of WooCommerce emails, for example: customer_completed_order
    For this, you can look it up on WooCommerce documentation. We don’t have our own email ID

    Or you can regard the IDs I listed below if there’re ones you need:

    new_order
    customer_on_hold_order
    customer_processing_order
    customer_completed_order
    customer_refunded_order
    customer_partially_refunded_order
    cancelled_order
    failed_order
    customer_reset_password
    customer_invoice
    customer_new_account
    customer_note

    Best regards.

    Thread Starter Caoba

    (@caoba)

    Hi,

    Yes, but those Emails IDs are the default email IDs of WooCommerce, I have created some custom emails for custom order statuses, and I want to know the Email ID of those custom emails.

    Thanks.

    Plugin Support angelagrey

    (@angelagrey)

    Hi,

    Thank you for your reply.
    Unfortunately, we can’t help in this case, our plugin works with WooCommerce emails only. We can’t detect the ID of emails by 3rd plugins.

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get Email ID’ is closed to new replies.