How to remove Bank Account details from WooCommerce Thank You page?

If we want to remove the bank account details from WooCommerce Thank You page, we’ll need to remove the action of the gateway, which places those details in the first place. This action is called woocommerce_thankyou_bacs and is registered in the WC_Gateway_BACS gateway class. To remove the action we need to get the class itself, so we can match everything the action was added with (remove_action only removes the exact action added with add_action).

Here is the complete example:

As you can see we get the “bacs” gateway class, store it in the $gateway variable and use the same class to remove the Thank You page action.

Comments 7

  1. This code does remove the bank details from the thank you page, however it also causes the bank details to be shown in the refund email, which is very confusing. Is there a fix for this?

    1. Post
      Author

      Hi Lina,

      The code will not add anything to the refund email. The instructions are added to the emails by the WC core. If you want to remove the bank details from the emails, you can try adding this under the remove_action in the snippet:

      remove_action( ‘woocommerce_email_before_order_table’, array( $gateway, ’email_instructions’ ), 10 );

    1. Post
      Author
  2. Thanks so much for the tutorial, is there a way to just remove the Bank Details but the Instruction content remains on the Thank you Page?

    1. Post
      Author

Leave a Reply to Lina Cancel reply

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