MANDATORY REGISTRATION FIELDS: split Address in 2 parts

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Membership MANDATORY REGISTRATION FIELDS: split Address in 2 parts

Viewing 11 reply threads
  • Author
    Posts
    • #119765
      ing.rapparini
      Participant

      When a new vendor register to a membership plan, I need as mandatory fields “Country”+”State/County”+”City” WITHOUT “address” (street + post number).

      So, when I go under: MEMBERSHIPS –> REGISTRATION FIELDS I need: SEE PIC 1
      And, when a new vendor register, it have to see: SEE PIC 2

      – M O R E O V E R –
      This 3 data (State+Country+City) have to be AUTOMATICALLY assigned to:
      A) Store Setting -> Location -> “Store Address”
      B) Store Setting -> Location -> “Store Location (find location)”
      C) Profile Manager -> Address
      D) A custom taxonomy (that gives me the opportunity to filter products by Location).

      I think is UNUSEFUL, and also negative, to let the user put 3 times the same value!

      I hope you understand what I’m asking for. Thanks

      Attachments:
      You must be logged in to view attached files.
    • #119987

      Hello,

      need as mandatory fields “Country”+”State/County”+”City” WITHOUT “address” (street + post number).AUTOMATICALLY assigned to:
      A) Store Setting -> Location -> “Store Address” C) Profile Manager -> Address

      >>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/

      add_filter('wcfm_marketplace_settings_fields_address',function($fields, $user_id) {
      	unset($fields['street_1']);
      	unset($fields['street_2']);
      	unset($fields['zip']);	
      	return $fields;
      },10,2);
      add_filter('wcfm_membership_registration_fields_address',function($fields) {
      	$fields['addr_1']['custom_attributes'] = array( 'required' => 0 );
      	$fields['city']['custom_attributes'] = array( 'required' => 1 );
      	$fields['state']['custom_attributes'] = array( 'required' => 1 );
      	unset($fields['addr_2']);
      	unset($fields['zip']);	
      	return $fields;
      });

      and add ths css n your theme’s style.css

      label[for=addr_1],.addr_1,#addr_1 {
      	display: none !important;
      }

      B) Store Setting -> Location -> “Store Location (find location)”
      >>Unfortunately it’s not possible. To point map you have to choose location from “Find Location”.

      D) A custom taxonomy (that gives me the opportunity to filter products by Location).
      >>This point is not so clear. Enable “Product List Radius Search” from WCFM dashbord -> Settings -> Geo Location -> Product List Radius Search (PFA) in WooCommerce shop page(Product archive page) you will find product search by location flter.Map and filter will visible under default WooCommerce product listing page like this – https://wcfmmp.wcfmdemos.com/

      Thanks.

      Attachments:
      You must be logged in to view attached files.
    • #120030
      ing.rapparini
      Participant

      A) C) OK SEEMS TO WORK!
      But in the admin menu: MEMBERSHIPS –> REGISTRATION FIELDS I find only “Store Address” as before (that is not a problem, but: don’t you think is better to have all fields separately (Country, City, ecc…)? This can be helpfull for all people in main plugin…).

      B) ok I understand, I though it was possible to point on the map by copying already present data with some css code. But please call this field in another way! Like for example “Store Map Location” or “Do you want to display your store in the store map page? Please find your location.” or “Store Exact Location”. Because it’s something that seems repetitive for users!

      D)THIS IS CRUCIAL: I need a “FILTER PRODUCT BY LOCATION” that will use the data mentioned before!
      I know the solution you told me, but is HORRIBLE! I don’t want a map! only a filter! Moreover: How can I filter products that are only in Italy in this way? Maximum Radius to Search is 500KM! I need to filter worldwide! Do you see other marketplaces like ebay, amazon, reverb, chrono24, ecc…with a map on the main shop page? :-)))

      ps. most of the time I try to asnwer in this forum I have this error message: ERROR: Your reply cannot be created at this time. WHy?????

      I need only a filter by State then, by region as subcategory!
      Please look into my site and look to the left filter called “Location”.
      This is what I need!!! To have this kind of filter, I had made a custom taxonomy called “Location” that user have to choose every time when they add a new product, but it’s a trick! I don’t want to use this because is too ripetitive! If the vendor has set his Location during the registration why have to set another time where is located at any new product?

      I hope you understand…sorry for this long message.
      Thanks

    • #120031
      ing.rapparini
      Participant

      ( I found where’s the problem in your forum…I can’t write urls!!! Even with the “link” function)

    • #121099

      Hello,

      Regarding point B,
      You can change the text using Loco Translate plugin https://localise.biz/wordpress/plugin/beginners

      Regarding point D,
      We understand importance of your requirement. Unfortunately correctly we have not this feature, yes you can achieve this using category. We are working on this feature, when we will implement this in near future we will let you know. Also it will be helpful if you can provide us the name of your theme.
      To hide map, add this code in your theme’s functions.php
      add_filter('wcfmmp_is_allow_product_list_map', '__return_false');

      Thanks.

    • #122159
      ing.rapparini
      Participant
      This reply has been marked as private.
    • #122162
      ing.rapparini
      Participant

      A) B) C) ok…

      D) I need simply something tells:

      COUNTRY set during registration = COUNTRY already present with exactly the same name in my Custom Taxonomy called “Location”

      IS IT SO IMPOSSIBLE?

      I use Shopkit theme with XforWoocommerce product filters, that works great. I use Translatepress for languages.

    • #122197

      Hello,

      Country field in vendor registration form are fetched from WooCommerce Location settings. Whatever locations you have set in “Selling location(s)” it will reflect in your vendor registration form.

      Thanks.

      Attachments:
      You must be logged in to view attached files.
    • #122216
      ing.rapparini
      Participant

      okay, I understand, but that’s not what I’m talking about.

      Once the seller has chosen his country he remains associated with it, RIGHT?
      I would like this association to be made also with the taxonomy which bears the same name already created by me:

      SET: COUNTRY (choosen from woocommerce) = COUNTRY (my custom taxonomy with the same name)

      Is this possible?

    • #122217
      ing.rapparini
      Participant

      so each vendor will have a Custom Taxonomy associated to his country.

    • #122265

      Hi,

      It’s need some custom development. You have to create a Country-Custom taxonomy mapping array, or settings panel where you can map. Example –

      /*****To save custom taxonomy in vendor meta***************/
      add_action('wcfm_membership_registration','save_custom_location_wcfm_membership_registration',10,2);
      function save_custom_location_wcfm_membership_registration($member_id, $wcfm_membership_registration_form_data) {
        print_r($wcfm_membership_registration_form_data);
        $country_taxonomy_mapping_arr = array("AX" => "location1","AF" => "location2");
        foreach ($country_taxonomy_mapping_arr as $country_taxonomy_mapping_key => $country_taxonomy_mapping_val) {
        	if($wcfm_membership_registration_form_data['wcfmvm_static_infos']['address']['country'] == $country_taxonomy_mapping_key) {
        		//save your Custom Taxonomy 
        		update_user_meta($member_id,'vendor_custom_taxonomy',$country_taxonomy_mapping_val);
        	}
        }  
      }
      /*******************save vendor custom taxonomy to product category********************************/
      add_action( 'after_wcfm_products_manage_meta_save', 'fn_custom_product_tag_save',10,2 );
      function fn_custom_product_tag_save($new_product_id, $wcfm_products_manage_form_data) {
      	$member_id = get_current_user_id();
      	$tag_name = get_user_meta($member_id,'vendor_custom_taxonomy',$country_taxonomy_mapping_val);
      	wp_set_object_terms( $new_product_id, $tag_name, 'product_cat', true );	
      }

      Hope it will help you.

      Thanks.

    • #122436
      ing.rapparini
      Participant

      Sorry, but I don’t understand…

      I ALREADY HAVE a custom taxonomy called “location”, that contains all the countries.

      Can you please rewrite the code considering this? Thanks

      [Note: The scope is to filter products by country! I already have a filter for this custom taxonomy, but now the vendor have to set it in any prduct, I was wandering to do this association in order to not set it for every product]

      • #122446

        Hello,

        As we mentioned earlier at present we have no any product location filter. So to achieve this you have to assign “custom taxonomy”(location) in your product.
        Using this “after_wcfm_products_manage_meta_save” (above mentioned in code) hook, when vendor create any product and save you can set your “location taxonomy country”
        to this product.(not need to select manually location in product).

        The scope is to filter products by country
        >>For this now you have to assign “custom taxonomy”(location) in your product.

        Thanks.

Viewing 11 reply threads
  • You must be logged in to reply to this topic.