Title: Help
Last modified: September 5, 2021

---

# Help

 *  [metalsunny](https://wordpress.org/support/users/metalsunny/)
 * (@metalsunny)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/help-877/)
 * i was given this snippet below by [@ivan](https://wordpress.org/support/users/ivan/)
   which works on my old theme for adding Bank name, bank account number and name
   on bank account. It works on my old theme but after i bought a more better theme
   and inserted same snippet on fresh wordpress installation. It did not work at
   all.
    Find the code below
 * Hi there,
 * please, try to add this custom code in the functions.php of your active theme:
 * add_filter('yith_wcaf_payment_email_required', '__return_false');
 * if ( defined( 'YITH_WCAF' ) ) {
    if ( ! function_exists( 'yith_wcaf_get_extra_fields')){
   function yith_wcaf_get_extra_fields() { return array( 'bank_name' => array( '
   type' => 'text', 'label' => __('Bank name', 'yith-woocommerce-affiliates'), '
   mandatory' => true, ), 'bank_account_num' => array( 'type' => 'text', 'label'
   => __('Bank account number', 'yith-woocommerce-affiliates'), 'mandatory' => true,),'
   bank_account_name' => array( 'type' => 'text', 'label' => __('Bank account name','
   yith-woocommerce-affiliates'), 'mandatory' => true, ), ); } }
 *  if ( ! function_exists( 'yith_wcaf_add_custom_fields' ) ) {
    function yith_wcaf_add_custom_fields(
   $user = false ) { $yith_wcaf_additional_fields = yith_wcaf_get_extra_fields();
 *  $user_id = $user instanceof WP_User ? $user->ID : false;
    $user_id = ( ! $user_id&&
   is_user_logged_in() ) ? get_current_user_id() : $user_id; $fields = ''; $admin
   = doing_action( 'show_user_profile' ) || doing_action( 'edit_user_profile' );
 *  if ( $admin ) {
    $fields .= "<hr/> <h3>Additional Affiliate Fields</h3> <table
   class='form-table'>"; }
 *  foreach ( $yith_wcaf_additional_fields as $field => $opts ) {
    if ( $user_id){
   $value = get_user_meta( $user_id, 'yith_wcaf_' . $field, true ); } else { $value
   = ! empty( $_POST[ 'yith_wcaf_' . $field ] ) ? $_POST[ 'yith_wcaf_' . $field ]:'';}
 *  $fields .= $admin ? '<tr><th>' : "<p class='form-row form-row-wide'>";
    $fields.
   = "<label for='yith_wcaf_" . $field . "'>" . $opts['label'] . ': ' . ( $opts['
   mandatory'] ? "<span class='required'>*</span>" : '' ) . '</label>'; $fields .
   = $admin ? '</th><td>' : ''; $fields .= "<input type='" . $opts['type'] . "' 
   class='input-text' name='yith_wcaf_" . $field . "' id='yith_wcaf_" . $field ."'
   value='$value' " . ( $opts['mandatory'] ? 'required' : '' ) . ' />'; $fields .
   = $admin ? '</td></tr>' : '</p>'; }
 *  if ( $admin ) {
    $fields .= '</table>'; }
 *  echo $fields;
    }
 *  add_action( 'yith_wcaf_register_form', 'yith_wcaf_add_custom_fields' );
    add_action('
   yith_wcaf_settings_form_after_payment_email', 'yith_wcaf_add_custom_fields' );
   add_action( 'show_user_profile', 'yith_wcaf_add_custom_fields', 21, 1 ); add_action('
   edit_user_profile', 'yith_wcaf_add_custom_fields', 21, 1 ); }
 *  if ( ! function_exists( 'yith_wcaf_register_custom_field' ) ) {
    function yith_wcaf_register_custom_field(
   $param1, $param2 = false ) { $yith_wcaf_additional_fields = yith_wcaf_get_extra_fields();
 *  if ( doing_action( 'yith_wcaf_new_affiliate' ) ) {
    $id = $param1; $affiliate
   = YITH_WCAF_Affiliate_Handler()::get_instance()->get_affiliate_by_id( $id ); 
   $user_id = $affiliate['user_id']; } elseif ( doing_action( 'yith_wcaf_save_affiliate_settings')){
   $user_id = $param2; } elseif ( doing_action( 'personal_options_update' ) || doing_action('
   edit_user_profile_update' ) ) { $user_id = $param1;
 *  if ( ! current_user_can( 'edit_user', $user_id ) ) {
    return false; } }
 *  if ( empty( $user_id ) ) {
    return false; }
 *  foreach ( $yith_wcaf_additional_fields as $field => $opts ) {
    if ( isset( $
   _REQUEST[ 'yith_wcaf_' . $field ] ) ) { update_user_meta( $user_id, 'yith_wcaf_'.
   $field, sanitize_text_field( $_REQUEST[ 'yith_wcaf_' . $field ] ) ); } }
 *  if( doing_action( 'yith_wcaf_save_affiliate_settings' ) ) {
    return true; }
 *  }
 *  add_action( 'yith_wcaf_new_affiliate', 'yith_wcaf_register_custom_field', 10,
   1 );
    add_action( 'yith_wcaf_save_affiliate_settings', 'yith_wcaf_register_custom_field',
   10, 2 ); add_action( 'personal_options_update', 'yith_wcaf_register_custom_field',
   10, 1 ); add_action( 'edit_user_profile_update', 'yith_wcaf_register_custom_field',
   10, 1 ); } }`

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [Iván Sosa](https://wordpress.org/support/users/ivansosa/)
 * (@ivansosa)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/help-877/#post-14847326)
 * Hi there,
 * hope you are doing well! 🙂
 * Can you describe exactly what happens?
    Do not the fields come out?
 * Let us know.
 * Have a great day!
 *  Thread Starter [metalsunny](https://wordpress.org/support/users/metalsunny/)
 * (@metalsunny)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/help-877/#post-14847530)
 * It shows critical error
 * There has been a critical error on this website. Please check your site admin
   email inbox for instructions.
    -  This reply was modified 4 years, 10 months ago by [metalsunny](https://wordpress.org/support/users/metalsunny/).
 *  [Manuel Peraza](https://wordpress.org/support/users/silverd/)
 * (@silverd)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/help-877/#post-14855537)
 * Hello there,
 * We hope you are doing well!😄
 * Could you show us which is the error you are receiving on your admin inbox email?
 * Have you tried to execute your site with our plugin without that personalized
   code that my mate gave to you?
 * Let us know any news, please.
 * Have a nice day!
 *  Thread Starter [metalsunny](https://wordpress.org/support/users/metalsunny/)
 * (@metalsunny)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/help-877/#post-14856082)
 * I have used the code for a theme before.
    But i am now using a new theme now.
   So when i insert the code. My sites give the error in the link here [https://prnt.sc/1rmsewk](https://prnt.sc/1rmsewk)
 *  Plugin Support [Christian Rodríguez](https://wordpress.org/support/users/christianrh/)
 * (@christianrh)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/help-877/#post-14866914)
 * Hello there,
 * hope you are doing well! 🙂
 * Looks like there is a character at the end that is wrong.
    Can you delete the
   last character? It’s a quote: `
 * Try it out and let us know any news.
 * Have a good day!
 *  Thread Starter [metalsunny](https://wordpress.org/support/users/metalsunny/)
 * (@metalsunny)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/help-877/#post-14867148)
 * No more error after i removed to quote. But the bank details i needed from the
   code did not show up at all,
 *  Plugin Support [Christian Rodríguez](https://wordpress.org/support/users/christianrh/)
 * (@christianrh)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/help-877/#post-14882563)
 * Hello there,
 * hope you are doing well! 🙂
 * Are you logged in?
    Can you try without being logged in?
 * Let us know any news.
 * Have a good day!
 *  Thread Starter [metalsunny](https://wordpress.org/support/users/metalsunny/)
 * (@metalsunny)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/help-877/#post-14882648)
 * I am not logged in. I tried it on browser with no user login
 *  [Héctor.G](https://wordpress.org/support/users/hectorgc/)
 * (@hectorgc)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/help-877/#post-14901811)
 * Hi there,
    Hope you are doing well!
 * Unfortunately, we have tried the code in our local environments and it works.
   It seems that the only error was the quote that you already deleted.
 * Maybe it could help if you give us the link to the topic where our mate Ivan 
   give you that code.
 * Also, I suggest you that try the code with another theme in order to see if the
   problem could come from the theme.
 * If you could try the code with only WooCommerce and Affiliates active, it will
   help you too in order to see where the problem came from.
 * You could also give us a screenshot of the Affiliate Dashboard when you are not
   logged in?
 * Please, let us know.
 * Have a great day!

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Help’ is closed to new replies.

 * ![](https://ps.w.org/yith-woocommerce-affiliates/assets/icon.svg?rev=3053144)
 * [YITH WooCommerce Affiliates](https://wordpress.org/plugins/yith-woocommerce-affiliates/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yith-woocommerce-affiliates/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yith-woocommerce-affiliates/)
 * [Active Topics](https://wordpress.org/support/plugin/yith-woocommerce-affiliates/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yith-woocommerce-affiliates/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yith-woocommerce-affiliates/reviews/)

 * 9 replies
 * 5 participants
 * Last reply from: [Héctor.G](https://wordpress.org/support/users/hectorgc/)
 * Last activity: [4 years, 9 months ago](https://wordpress.org/support/topic/help-877/#post-14901811)
 * Status: not resolved