I am using woocommerce site and I have enabled the direct bank transfer payment method. I want to remove the account number of order thank you page but want to show in emails. Same function is called in both cases.
How can I differentiate it to show the account number only in email.. not on thank you page. I have tried it like:
global $pagename;
if($pagename == "checkout"){
//remove bank account number
}else{
//show bank account number
}
But its Not working.. can anyone give me suggestions...
Also i used this.
add_action('woocommerce_before_template_part', 'thankyou_bacs');
function thankyou_bacs() {
/* get bacs payment gateway class */
$methods = WC()->payment_gateways->payment_gateways();
$bacs_class = $methods['bacs'];
unset($bacs_class->account_details[0]['account_name']);
unset($bacs_class->account_details[0]['account_number']);
}
working great for checkout page, but hiding these details from email too. :( :(