Customize Bank Payment Fields in Dokan

How to Make the Bank Payment Required Fields Unrequired

Rabbir Shad

|

|

0

|

9 min read

The payment system is a very important part of any eCommerce platform. Having a solid payment system not only makes the transaction process smooth but also builds trust among customers.

There are various types of payment gateways. Cash on delivery, bank payments, and adaptive and non-adaptive payment gateways. The most basic payment gateways that every eCommerce and multivendor marketplace has are bank transfers and cash on delivery.

Dokan Multivendor is a popular multivendor marketplace plugin that has all these types of payment gateways. A bank transfer is one of them.

As different countries and continents require different types of information for bank transfers, users often ask us about the process to customize the bank payment fields.

Today we are going to show you how to customize the bank payment fields using custom codes.

But first-

Why Bank Fields are Important in the Checkout Process of a Marketplace

In a marketplace checkout process, a “Bank Field” typically refers to the section where the buyer provides their bank account details for making payments. This field is important for several reasons:

  1. Payment Processing: The bank account details provided by the buyer are essential for processing payments for the products or services they are purchasing. The marketplace platform uses this information to transfer funds from the buyer’s account to the seller’s account.
  2. Payment Verification: Having the buyer’s bank account details allows the marketplace platform to verify the authenticity of the payment. By confirming the details provided by the buyer, the platform can ensure that the payment is coming from a legitimate source and reduce the risk of fraudulent transactions.
  3. Payouts to Sellers: In a marketplace model, sellers need to be paid for the products or services they provide. The bank account details collected during the checkout process enable the marketplace platform to facilitate payouts to sellers efficiently. Once a transaction is completed, the platform can transfer the funds directly to the seller’s bank account.
  4. Refunds and Disputes: In cases of refunds or disputes, having the buyer’s bank account details simplifies issuing refunds or resolving payment disputes. The platform can easily refund the amount to the buyer’s bank account or investigate the transaction if there are any discrepancies.
  5. Compliance and Regulations: Collecting bank account details as part of the checkout process may be necessary to comply with financial regulations and anti-money laundering (AML) requirements. This information may be used for identity verification and to ensure that transactions are conducted under applicable laws and regulations.

Now, let’s see how to customize the bank payment fields:

How to Customize the Bank Payment Fields in Dokan

We are going to show how three types of customizations

  • How to Change the Label and Placeholder of Bank Payment Fields
  • How to Make the Bank Payment Required Fields Unrequired
  • How to Make the Bank Payment Unrequired Fields Required

How to Change the Label and Placeholder of Bank Payment Fields

First, we will start with changing the label and placeholder of bank payment fields. Here is what the current fields and placeholders look like in the vendor setup wizard

This is a screenshot of the bank payment field

In order to change the label and placeholder, you need to change two functions:

  • ‘label’
  • ‘placeholder

Now, copy and paste the below code in your child theme’s function.php file

/*
You can change any field title or remove any feild for the vendor -> settings -> payment -> bank transfer method. Please note that this
code need to be placed on your child-theme functions.php file
*/

/**
* Change the payment title
*
* @param array $methods
*
* @return array
*/
function dokan_2022_change_whithdraw_callback( $methods ) {
   $methods ['bank']['title'] = __( 'Wire Transfer', 'dokan-lite' ); //title can be changed as per your need

   return $methods;
}

add_filter( 'dokan_withdraw_methods', 'dokan_2022_change_whithdraw_callback', 12 );

/**
* Change the bank payment fields labels and placeholders
*
* @param array $fields
*
* @return array
*/
function dokan_2022_change_bank_payment_fields_placeholders_and_labels( $fields ) {
   $fields['ac_name']  = [
       'label'       => __(  'Account Holder', 'dokan-lite' ),
       'placeholder' => __( 'Your bank account name', 'dokan-lite' ),
   ];

   $fields['ac_type']  = [
       'label'       => __(  'Account Type', 'dokan-lite' ),
       'placeholder' => __( 'Account Type', 'dokan-lite' ),
   ];

   $fields['ac_number'] = [
       'label'       => __(  'Account Number', 'dokan-lite' ),
       'placeholder' => __( 'Account Number', 'dokan-lite' ),
   ];

   $fields['routing_number'] = [
       'label'       => __(  'Routing Number', 'dokan-lite' ),
       'placeholder' => __( 'Routing Number', 'dokan-lite' ),
   ];

   $fields['bank_name'] = [
       'label'       => __(  'Bank Name', 'dokan-lite' ),
       'placeholder' => __( 'Name of bank', 'dokan-lite' ),
   ];

   $fields['bank_addr'] = [
       'label'       => __(  'Bank Address', 'dokan-lite' ),
       'placeholder' => __( 'Address of your bank', 'dokan-lite' ),
   ];

   $fields['iban'] = [
       'label'       => __(  'Bank IBAN', 'dokan-lite' ),
       'placeholder' => __( 'IBAN', 'dokan-lite' ),
   ];
   $fields['swift'] = [
       'label'       => __(  'Bank Swift Code', 'dokan-lite' ),
       'placeholder' => __( 'Swift Code', 'dokan-lite' ),
   ];
   $fields['declaration'] = [
       'label'       => __(  'I attest that I am the owner and have full authorization to this bank account', 'dokan-lite' ),
       'placeholder' => __( '', 'dokan-lite' ),
   ];
   $fields['form_caution'] = [
       'label'       => __( 'Please double-check your account information!', 'dokan-lite' ),
       'placeholder' => __( 'Incorrect or mismatched account name and number can result in withdrawal delays and fees', 'dokan-lite' ),
   ];

   return $fields;
}

add_filter( 'dokan_bank_payment_fields_placeholders', 'dokan_2022_change_bank_payment_fields_placeholders_and_labels' ); 

Now, we will change the –

‘label’ => __( ‘Bank Address’, ‘dokan-lite’ ), To–> ‘label’ => __( ‘Bank Real Address’, ‘dokan-lite’ ),

Here is how the new bank payment fields will look like-

This is a screenshot of the customized bank payment fields

How to Make the Bank Payment Required Fields Unrequired

Before going forward,

You can’t make changes like making bank/wire transfer required fields unrequired or vice-versa in the vendor setup wizard. But you can make changes in the vendor dashboard payment section.

We are going to start with making the bank payment required fields unrequired. First, log in to any vendor dashboard and go to Settings–> Payment. From the dropdown menu, choose Wire Transfer. Here are the ” dokan_bank_payment_available_fields();”-

[
        'ac_name',
        'ac_type',
        'ac_number',
        'routing_number',
        'bank_name',
        'bank_addr',
        'iban',
        'swift',
    ]

Now, paste the below code on your child theme’s function.php file

This is a screenshot of the function.php file
add_filter(
    'dokan_bank_payment_required_fields', function ( $required_fields ) {
		unset( $required_fields['ac_type'] );

		return $required_fields;
	}
);

This code will make the “Account Type” field unrequired. But if you want, you can make various fields unrequired as well. Just use the “unset( $required_fields[‘?’] );” option for the fields you want to make unrequited.

dokan multivendor plugin

How to Make the Bank Payment Unrequired Fields Required

Now, to make the bank payment unrequired fields are required, just copy and paste the below code in the child theme’s function.php file

add_filter(
  'dokan_bank_payment_required_fields', function ( $required_fields ) {
  $required_fields['swift'] = __( 'swift is required', 'dokan-lite' );

  return $required_fields;
}
);

This will make the “Bank Swift Code” field required and the vendors need to add this code to complete their bank setup.

This is a screenshot of making the swift field required

Conclusion

Here we are, this is how to make the bank payment required fields unrequired and vice versa. Also, we have shown you how to customize the bank fields in the setup wizard as well.

Using custom codes is better than using extra plugins as it will put extra load on your website and may hamper your site’s performance.

If you face any trouble while adding custom codes, then please leave a comment in the comment section.

mail 3d
Newsletter | Footer

Leave a Reply

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