Remove bank details from WooCommerce order emails

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.

Comments 32

    1. Post
  1. Hi,
    Have tried this code in my functions.php and doesn’t seem to be working.
    I’ve managed to remove the banking instructions with a plugin (that I’m using to customise the emails), but the actual banking details still show up in the emails. Any ideas?

    1. Post

      Hi Ivo,

      The BACS instructions will show up in the email, but the bank account details will not. The `prefix_remove_bank_details` removes the core details and the `prefix_email_instructions` adds just the BACS instructions. No need to use a plugin to remove the bank instructions, just remove the `prefix_email_instructions`(line: 2 to 20) part of the code and all information will be removed.

      1. Hi,
        Thanks for the reply. I have tried that snippet and unfortunately still have no luck. The banking information still shows in the email :(.

  2. Hey,
    great tutorial and great explanation, just one question:

    can you explain, why you put “$available_gateways[‘bacs’]” as the first params in callable function(first element in array), in this remove_action?

    remove_action( ‘woocommerce_email_before_order_table’, array( $available_gateways[‘bacs’], ’email_instructions’ ), 10, 3 );


    1. Post

      Hi Matt,

      It is to give context to the function. You are basically saying remove the action set with that method (’email_instructions’) from that object ($available_gateways[‘bacs’] which is WC_Gateway_BACS).
      To remove the action you need the exact same parameters passed as when you added it.

  3. I know this post is pretty old, but I’m hoping it still works… However, is there a way to filter/obfuscate the bank information rather than removing it completely?

    For example, instead of removing it from the email entirely, could this be modified to replace all but the last 4 digits of the routing/account numbers with asterisks in the email for orders made with the `authorize_net_aim` payment gateway?

    1. Post

      Hi Josh,

      Yes, you can display any information there. If you have access to this data just display it with
      echo substr($data, -4);

  4. Hello. My friend, I need to remove the bacs info from the email if the client select credit card option and leave it if they select direct transfer. This code will work for me in that case? I’m sorry, I’m new in this. Thank you 🙂

    1. Post

      Hi Catalina,

      The bank details should not be present if the customers select a different payment option than BACS. You should not do anything in this case.

      1. Hi. Thank you 🙂 I think my problem is I’m using my local direct transfer plugin and not the one that comes with Woocommerce. So, I’ll need to use that one instead mine, am I right? Thank you.

        1. Post

          Yes, if you are using the built-in gateway, you will only get the bank details when the customer chooses it. Not sure about the other plugin option because I don’t know what it is.

  5. Hi,

    I would like to delete the bank information from the email but i would like to add “You have chosen to pay trough “mention the payment gatewaye chosen”.

    Could you help me with the code?



  6. Hi there,
    I look at the tutorial and try it, but its not working, maybe I did something wrong. The bank detail, like instructions, account name, account number, bank name still showing at customer order on hold email.
    Is there any other method to remove it from the email?

    Anyway, the website not yet online, because of some things need to setup.

    Thank you.

    1. It worked, but what is weird it does not work anymore after today’s WordPress update. Code is still in child theme functions.php
      Any clue what’s wrong?

  7. Hey, great work! thank you very much!

    I got one more problem: when I add the code as described, the account details are gone. yet, I still find the instructions for the customer to transfer the money and that the order will be shipped once the money is transferred.

    How and where can I modify that?

    Thank you so much! Best, David

    1. Post

      Hi David,

      Refer to my other post, of removing the BACS details from the Thank You page. The process of removing the details from the email is basically the same but you are removing the other hook, like so: remove_action( 'woocommerce_email_before_order_table', array( $gateway, 'email_instructions' ), 10, 3 );

  8. Hi Vanbo,

    Awesome tutorial. It comes close to what I need. Maybe you can help?

    I offer COD as a payment gateway and each time I add a note to customer, the email they receive with that note also includes all payment info again. How can I hide that info for those emails?

    The payment info should still be shown on the thank you page and in the processing email.

    1. Post

      Hi Lodix,

      Just open the email template (customer-note.php) and remove all actions after the “For your reference, your order details are shown below” message. You can remove the message itself as it will not be necessary.

    1. Post
  9. Hi,
    thank you for your code, it works flawlessly.
    I’ve got problem: in my workflow, after the customer end his order, I send an email without the bank info (just an order received advice), then I add the shipping costs and send another email.
    Obviously with this email I have to send the bank infos also.
    How can I do?

    Many thanks.

    1. Post

      Hi Francesco,

      The bank info details are attached to the ‘woocommerce_email_before_order_table’ action. So in most cases when you send the second email, which needs to include the bank info, all you need to add is the following code:

      Of course the “$order” needs to be the WC_Order object.

      Hope that helped.

      1. Hi Vanbo,

        I have the same issue but don`t know what do you mean by “Of course the “$order” needs to be the WC_Order object.”?

        Could you please help me?

        1. Post

          Hi Ashad,

          you get the WC_Order object by calling `$order = wc_get_order( $order_id );`. The $order_id needs to be the ID value of the order you are trying to send email for.

  10. Hi,

    This tutorial is exactly the one I’m looking for. But, since I’m not a programmer, could you please let me know where should I put the code above? In which .php file? Please advise. Many many thanks.

    1. Post

Leave a Reply

Your email address will not be published. Required fields are marked *