Removing payment instructions from certain emails
-
Hello!
I’ve been trying to get rid of the payment instructions that comes with every customer email for the ‘cod’ payment gateway, specifically for certain emails such as the invoice email.
The information seems to be hooked into the order details, so unhooking order details just removes the order details and the payment instructions. All I want to get rid of is the payment instructions.
So what I ended up trying to do is this:
function custom_woocommerce_email_before_order_table($order, $sent_to_admin, $plain_text, $email){ $available_gateways = WC()->payment_gateways->payment_gateways(); if ( isset( $available_gateways['cod'] ) && $email->id == 'customer_invoice'){ remove_action( 'woocommerce_email_before_order_table', array( $available_gateways['cod'], 'email_instructions' ), 10, 3 ); } } add_action( 'woocommerce_email_before_order_table','custom_woocommerce_email_before_order_table', 20, 4);
Unfortunately, the remove_action is probably called too late at this point which is why it doesn’t work.
Is there any neat solutions to this?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Removing payment instructions from certain emails’ is closed to new replies.