Show custom attribute filled by Vendor/Host in payout form

Hello, I have created a custom required attribute for vendors called for example bank number, so they have to fill it in their profile. Now when they click on payout, I would like to show them their filled information in that attribute in the payout form, so they can check it one more time if its correct and if they really want to send their money there. So the attribute they filled in their profile, how to show it for them in the payout form so they have to see it and confirm that yes, it is really correct number where they want the money sent? It would be much better protection for the admin because users literally have to confirm it and it would be tied to the payout, no matter how many times they change it in their profile.

Just showing the attribute they filled in their profile on the payout form would be enough, because if they click on payout, they just agree to that info they fill. Just so its somewhere there stated their filled attribute like bank account number.

I searched forum and couldn’t find, Is there any snippet or css tweak for this? Thank you

Please try this sample code snippet:

add_filter(
 'hivepress/v1/forms/payout_request',
 function ( $form ) {
  if ( ! is_user_logged_in() ) {
   return $form;
  }

  $vendor = \HivePress\Models\Vendor::query()->filter(
   array(
    'user' => get_current_user_id(),
   )
  )->get_first();

  if ( ! $vendor ) {
   return $form;
  }

  $bank_number = $vendor->get_bank_number();

  $form['fields']['_bank_number'] = array(
   'label'    => 'Bank Number',
   'type'     => 'text',
   'default'  => $bank_number,
   'readonly' => true,
   '_order'   => 25,
  );

  return $form;
 },
 1000
);

It adds a read-only Bank Number field to the payout form, please replace the “bank_number” part in $vendor->get_bank_number(); with the created vendor attribute name.

Hope this helps

This works great. Thank you Ihor

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.