Celebrating 20K+ active installs! Enjoy upto35% off on our addons!

CLAIM OFFER
01Day 14Hour 05Min 20Sec

Customize vendor registration fields

This topic contains 9 replies, has 3 voices, and was last updated by Avatar bolon_campana 5 months, 4 weeks ago.

  • Author
    Posts
  • #83643
    Avatar
    Gallo
    Participant

    Hello, I was trying to cutomize the vendor registration field. First, I found a code in the forums and tried to see if it works for removing address 2 and the zip code (code in comments). But then I wanted to maintain the address 2 and remove state and zip code. Unfortunately, the first change remains, address 2 does not appear and the state is still there. He is the code I used from the site’s forums:

    // function wcfm_marketplace_settings_fields_0410_address( $address_fields ) {
    // 	if( isset( $address_fields['addr_2'] ) ) {
    // 	  $address_fields['addr_2']['class'] = 'wcfm_custom_hide';
    // 	  $address_fields['addr_2']['label_class'] = 'wcfm_custom_hide';
    // 	}
    // 	if( isset( $address_fields['zip'] ) ) {
    // 	  $address_fields['zip']['class'] = 'wcfm_custom_hide';
    // 	  $address_fields['zip']['label_class'] = 'wcfm_custom_hide';
    // 	}
    // 	return $address_fields;
    // }
    // add_filter( 'wcfm_marketplace_settings_fields_address', 'wcfm_marketplace_settings_fields_0410_address' );
    // add_filter( 'wcfm_membership_registration_fields_address', 'wcfm_marketplace_settings_fields_0410_address' );
    
    function wcfm_marketplace_settings_fields_0410_address( $address_fields ) {
    	$address_fields = wcfm_hide_field( 'state', $address_fields ); 
    	if( isset( $address_fields['state'] ) ) unset( $address_fields['state'] );
    	return $address_fields;
    }
    add_filter( 'wcfm_marketplace_settings_fields_address', 'wcfm_marketplace_settings_fields_0410_address' );
    add_filter( 'wcfm_membership_registration_fields_address', 'wcfm_marketplace_settings_fields_0410_address' );
  • #83785
    WCFM Forum
    WCFM Forum
    Keymaster

    Hi,

    This codes are for some other purpose.

    What you want to change in Registration form?

    Thank You

  • #83890
    Avatar
    Gallo
    Participant

    Hi,
    I would like to remove “Sate” (Etat/Pays in the French version), make “Zip code” optional, change “City” (“Ville/Localité” in the French verion) to just “Localité”, and chabge “Country” to “Commune” and replace the list of countries in the drop-down menu with my own names.

  • #84021
    WCFM Forum
    WCFM Forum
    Keymaster

    HI,

    Please add this to code to your site –

    function wcfm_marketplace_address_fields_rearrange( $address_fields ) {
    	if( isset( $address_fields['zip'] ) && isset( $address_fields['zip']['custom_attributes'] ) ) { 
    	  unset( $address_fields['zip']['custom_attributes'] );
    	}
            if( isset( $address_fields['state'] ) ) { $address_fields['state']['label'] = 'Etat/Pays'; }
            if( isset( $address_fields['city'] ) ) { $address_fields['city']['label'] = 'Localité'; }
            if( isset( $address_fields['country'] ) ) { $address_fields['country']['label'] = 'Commune'; }
    	return $address_fields;
    }
    add_filter( 'wcfm_marketplace_settings_fields_address', 'wcfm_marketplace_address_fields_rearrange' );
    add_filter( 'wcfm_membership_registration_fields_address', 'wcfm_marketplace_address_fields_rearrange' );
    add_filter( 'wcfm_wcmarketplace_settings_fields_customer_support', 'wcfm_marketplace_address_fields_rearrange' );

    Add this code to your child theme’s functions.php
    In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/

    Thank You

  • #84118
    Avatar
    Gallo
    Participant

    Hi,
    I am sorry, it is a little different than what I wanted.
    Now, I want to remove “Sate” “City” “Country” and make “zip code” optional.
    Please could you show me the code for that.

    Thank you

  • #84415
    WCFM Forum
    WCFM Forum
    Keymaster

    OK, please use this revised code –

    function wcfm_marketplace_address_fields_rearrange( $address_fields ) {
    	if( isset( $address_fields['zip'] ) && isset( $address_fields['zip']['custom_attributes'] ) ) { 
    	  unset( $address_fields['zip']['custom_attributes'] );
    	}
    	$address_fields = wcfm_hide_field( 'state', $address_fields );
    	$address_fields = wcfm_hide_field( 'city', $address_fields );
    	$address_fields = wcfm_hide_field( 'country', $address_fields );
    	return $address_fields;
    }
    add_filter( 'wcfm_marketplace_settings_fields_address', 'wcfm_marketplace_address_fields_rearrange' );
    add_filter( 'wcfm_membership_registration_fields_address', 'wcfm_marketplace_address_fields_rearrange' );
    add_filter( 'wcfm_wcmarketplace_settings_fields_customer_support', 'wcfm_marketplace_address_fields_rearrange' );

    Thank You

  • #84498
    Avatar
    Gallo
    Participant

    Thank you, that works

  • #84738
    Avatar
    bolon_campana
    Participant

    I have an associated question. Do these kind of fixes stay after updating the plugin, or they must be patched with every update. Thanks in advance!

  • #84962
    WCFM Forum
    WCFM Forum
    Keymaster

    Well, you have to add this code to your child theme’s functions.php
    In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/

    Plugin’s update will not hamper this at all.

    Thank you

  • #85863
    Avatar
    bolon_campana
    Participant

    Thanks a lot!

The topic ‘Customize vendor registration fields’ is closed to new replies.