This we were asked, if there is a way to remove only the bank details from a WooCommerce order email. Here is the exact question:
I would like to remove the bank account info that is displayed in the order-processing-email when chosen payment method is cash in advance. I know this is set though
woocommerce_email_before_order_table – action … could you help me with this
So I wrote this quick tutorial of how to do this. Here is the complete code for removing the bank details:
Lets break this down:
1. We need to remove the hook already in place to output the bank details: line 21 – 30. We take the gateway object and remove the hook, if the gateway is one of the available gateways. In this case the gateway is BACS or Bank Transfer.
2. We add our own action to output the bank instructions, but not the details: line 1 – 19. In this case we take the available gateways, check if the our gateway is available (line: 4-12), then we add the saved instructions only, much the same way they are added by the original hook(line: 14-19). Here is a place where you can add anything else you might want related to the bank details.
If you have any questions about this tutorial or you want to know how to do something else in WordPress or WooCommerce, just ask in the comments below.