Created
March 21, 2020 19:47
-
-
Save torbentschechne/4ac61891102fea961bcc1c6af9d0aa4c to your computer and use it in GitHub Desktop.
WooCommerce - add bank details to email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_email_after_order_table', 'custom_email_after_order_table', 10, 4 ); | |
function custom_email_after_order_table($order, $sent_to_admin, $plain_text, $email) { | |
if( $order->get_payment_method() === 'bacs') { | |
$bacs_info = get_option('woocommerce_bacs_accounts'); | |
if ($bacs_info) : foreach ($bacs_info as $account) : | |
$account_name = esc_attr(wp_unslash($account['account_name'])); | |
$bank_name = esc_attr(wp_unslash($account['bank_name'])); | |
$account_number = esc_attr($account['account_number']); | |
$sort_code = esc_attr($account['sort_code']); | |
$iban_code = esc_attr($account['iban']); | |
$bic_code = esc_attr($account['bic']); | |
echo '<h2 style="margin-top:15px;">Unsere Bankverbindung: </h2>'; | |
echo '<p>' . $account_name . ' - ' . $bank_name . ' </p>'; | |
echo '<p>KONTONUMMER: ' . $account_number . ' <br/>'; | |
echo 'BANKLEITZAHL: ' . $sort_code . ' <br/>'; | |
echo 'IBAN: ' . $iban_code . ' <br/>'; | |
echo 'BIC: ' . $bic_code . '</p>'; | |
endforeach; endif; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment