If you have set up you Dokan Store so that clients can not buy form multiple Vendor at the same time, it may be that you are not interested in split payments and want the Shop’s bank details to show on the checkout page when the shopper has chosen to pay with Direct Payment.

The first page you need to modify is:

1. woocommerce/includes/gateways/bacs/class-wc-gateway-bacs.php

With the change below, we will be reading the Banking information on the Vendors / Shop’s page and rather show that banking details.

You need to modify private function bank_details( $order_id = ” ) like in the code below.

You will see that there is a section at the top starting with // Start – Dokan Multistore stuff. In here we first get $seller (Vendor / Shop Id) of this order. It should be the id of the user linked to this shop. Once we have that id, we can get the object $store_info. Now that we have the store information we can extract all the values and use it in a pattern similar to the original code, generate the HTML.

All this new code was added with an if statement (if it could find some of this vendor banking stuff), else if, we revert to the original WooCommerce code. This code is nowhere complete, (but does work). It’s just for giving you a head start.

    /**
     * Get bank details and place into a list format.
     *
     * @param int $order_id Order ID.
     */
    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 );
        
        // Start - Dokan Multistore stuff
        $seller = dokan_get_seller_id_by_order( $order_id );
        $store_info = dokan_get_store_info($seller);
        $store_ac_name = $store_info['payment']['bank']['ac_name']; 
        $store_ac_number = $store_info['payment']['bank']['ac_number'];
        $store_bank_name = $store_info['payment']['bank']['bank_name']; 
        $store_bank_addr = $store_info['payment']['bank']['bank_addr'] ;
        $store_routing_number = $store_info['payment']['bank']['routing_number'] ;
        $store_iban = $store_info['payment']['bank']['iban'] ;
        $store_swift = $store_info['payment']['bank']['swift'] ;
        if ( ! empty(store_ac_name)) {
            $store_account_html = '';
            $store_has_details  = false;
            $store_account_html .= '<ul class="wc-bacs-bank-details order_details bacs_details">' . PHP_EOL;
            $store_account_fields = apply_filters(
                'woocommerce_bacs_account_fields',
                array(
                    'account_name'      => array(
                        'label' => __( 'Account name', 'woocommerce' ),
                        'value' => $store_ac_name,
                    ),
                    'bank_name'      => array(
                        'label' => __( 'Bank', 'woocommerce' ),
                        'value' => $store_bank_name,
                    ),
                    'sort_code'      => array(
                        'label' => __( 'Branch Code', 'woocommerce' ),
                        'value' => $store_routing_number,
                    ),
                    'account_number' => array(
                        'label' => __( 'Account number', 'woocommerce' ),
                        'value' => $store_ac_number,
                    ),
                    'iban'           => array(
                        'label' => __( 'Pay Ref', 'woocommerce' ),
                        'value' => $order_id,
                    )
                ),
                $order_id
            );
            foreach ( $store_account_fields as $field_key => $field ) {
                if ( ! empty( $field['value'] ) ) {
                    $store_account_html .= '<li class="' . esc_attr( $field_key ) . '">' . wp_kses_post( $field['label'] ) . ': <strong>' . wp_kses_post( wptexturize( $field['value'] ) ) . '</strong></li>' . PHP_EOL;
                    $store_has_details   = true;
                }
            }
            $store_account_html .= '</ul>';
            if ( $store_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 . $store_account_html ) . '</section>';
            }
        }
        // End - Dokan Multistore stuff


        elseif ( ! 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(
                        'account_name'      => array(
                            'label' => __( 'Account name', 'woocommerce' ),
                            'value' => $bacs_account->account_name,
                        ),
                        'bank_name'      => array(
                            'label' => __( 'Bank', 'woocommerce' ),
                            'value' => $bacs_account->bank_name,
                        ),
                        'sort_code'      => array(
                            'label' => $sortcode,
                            'value' => $bacs_account->sort_code,
                        ),
                        'account_number' => array(
                            'label' => __( 'Account number', 'woocommerce' ),
                            'value' => $bacs_account->account_number,
                        ),
                        'iban'           => array(
                            'label' => __( 'Pay Ref', 'woocommerce' ),
                            'value' => $order_id,
                        )
                    ),
                    $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>';
            }
        }

    }

to be continued…