On the User Registration form, how can I include a country selection field compatible with the country field of WooCommerce?
Thanks for your help.
Best regards,
Francisco R.
Hi, I'm not sure I understand what you mean by compatible. If you mean you want the same options and option values, then I can help you set up a select field with those option names and values. However, I can't guarantee these will always stay in sync with WooCommerce's field. For example, if a country changes abbreviations or splits into two new countries, your field will be out of sync as soon as WooCommerce updates their field. Believe it or not, this happens more often than you might think.
I also can't help with a typeahead, multi-select interface like the WooCommerce country field. The select field I can help you set up is a basic HTML select field.
Here's how I would go about doing something like this. Gather the option names and values from the WooCommerce select field. Add these into a CSV file. Next, create your custom field in Types, and add a couple of options manually. Then you can export this custom field using Toolset Import / Export. Open the generated XML file and insert your options here. You may be able to transform a CSV file with all the appropriate information into a valid XML structure. This isn't a supported feature of Toolset, so it's not something I would be able to assist you with. Save the XML file and re-import this field using Toolset Import / Export. Your new options will appear.
Another ticket discusses this approach and includes some code samples:
https://toolset.com/forums/topic/import-custom-fields-from-pre-defined-list/
Let me know if you have any specific questions and I will try to help.
But this is a basic functionality of member management plugins to synchronize the data of woocommerce with those of the user. This should be a feature base on Toolset, since Toolset is a plugin for user management, access and woocommerce.
When I create a user with Toolset, their data should be available from WooCommerce.
Thanks for your help.
Best regards,
Francisco R.
But this is a basic functionality of member management plugins to synchronize the data of woocommerce with those of the user.
Let me make sure I understand what you're trying to accomplish so I can come up with a good solution for you. When an order is submitted in WooCommerce, if the user elects to create an account, their billing address is added to the usermeta table in the database. The country from this address is saved as 'billing_country', and is a field managed by WooCommerce, meaning that if I go to a User's profile in wp-admin I will not see this field displayed.
- Is this is the country selection you are referring to? If not, which country selection are you referring to, exactly?
- Would you like to allow users to predefine their billing_country, using CRED, during User Registration?
- What purpose will this serve? Will you be relying on this billing_country value elsewhere on the site, using it as a default shipping address for future orders, or other?
and is a field managed by WooCommerce, meaning that if I go to a User's profile in wp-admin I will not see this field displayed.
As you can see in the screenshot in the user profile you see the data of woocommerce.
- Is this is the country selection you are referring to?
Yes.
- Would you like to allow users to predefine their billing_country, using CRED, during User Registration?
Yes.
- What purpose will this serve? Will you be relying on this billing_country value elsewhere on the site, using it as a default shipping address for future orders?
Yes.
UserPro has this system and other member management plugins also have this system.
Thanks for your help.
Best regards,
Francisco R.
Okay I understand better now, thanks. I don't think it's well integrated like this in the current CRED system but I will reach out to our developers to see if they are aware of a way to accomplish what you're looking for, while staying in sync with WooCommerce. Hopefully they will have a good solution for you, so please stand by and I will update you as soon as I have more information to share.
Do not worry, I've already asked for a refund of my money. Apparently the developers of Toolset do not see the products of the competition. Toolset user management needs a lot of love to be something similar to other member management products.