Get Email ID
-
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)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Get Email ID’ is closed to new replies.