Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
WC_Gateway_BACS::bank_details( int $order_id = '' )
Get bank details and place into a list format.
Description Description
Parameters Parameters
- $order_id
-
(Optional) Order ID.
Default value: ''
Source Source
File: includes/gateways/bacs/class-wc-gateway-bacs.php
private function bank_details( $order_id = '' ) { if ( empty( $this->account_details ) ) { return; } // Get order and store in $order. $order = wc_get_order( $order_id ); // Get the order country and country $locale. $country = $order->get_billing_country(); $locale = $this->get_country_locale(); // Get sortcode label in the $locale array and use appropriate one. $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'woocommerce' ); $bacs_accounts = apply_filters( 'woocommerce_bacs_accounts', $this->account_details ); if ( ! empty( $bacs_accounts ) ) { $account_html = ''; $has_details = false; foreach ( $bacs_accounts as $bacs_account ) { $bacs_account = (object) $bacs_account; if ( $bacs_account->account_name ) { $account_html .= '<h3 class="wc-bacs-bank-details-account-name">' . wp_kses_post( wp_unslash( $bacs_account->account_name ) ) . ':</h3>' . PHP_EOL; } $account_html .= '<ul class="wc-bacs-bank-details order_details bacs_details">' . PHP_EOL; // BACS account fields shown on the thanks page and in emails. $account_fields = apply_filters( 'woocommerce_bacs_account_fields', array( 'bank_name' => array( 'label' => __( 'Bank', 'woocommerce' ), 'value' => $bacs_account->bank_name, ), 'account_number' => array( 'label' => __( 'Account number', 'woocommerce' ), 'value' => $bacs_account->account_number, ), 'sort_code' => array( 'label' => $sortcode, 'value' => $bacs_account->sort_code, ), 'iban' => array( 'label' => __( 'IBAN', 'woocommerce' ), 'value' => $bacs_account->iban, ), 'bic' => array( 'label' => __( 'BIC', 'woocommerce' ), 'value' => $bacs_account->bic, ), ), $order_id ); foreach ( $account_fields as $field_key => $field ) { if ( ! empty( $field['value'] ) ) { $account_html .= '<li class="' . esc_attr( $field_key ) . '">' . wp_kses_post( $field['label'] ) . ': <strong>' . wp_kses_post( wptexturize( $field['value'] ) ) . '</strong></li>' . PHP_EOL; $has_details = true; } } $account_html .= '</ul>'; } if ( $has_details ) { echo '<section class="woocommerce-bacs-bank-details"><h2 class="wc-bacs-bank-details-heading">' . esc_html__( 'Our bank details', 'woocommerce' ) . '</h2>' . wp_kses_post( PHP_EOL . $account_html ) . '</section>'; } } }