User Registration

When saving address fields with the User Registration add-on, you can run into a problem integrating with other plugins. Gravity Forms records the country by its name — in fact, it uses the translated country name, in whatever language your website is running. Most other plugins use the ISO 3166 2-character code for the country.

This means that if you want to register new customers for your WooCommerce shop via Gravity Forms User Registration, you need to convert the country name to its ISO 3166 code. Which is where Address Enhanced steps in to help.

Create your feed

When you create your User Registration feed, you can map each sub-field of your form’s address field to a separate user meta field. If you already have some customers in your shop, this is really easy because you can pick the user meta field names off a list. The screen capture below shows mapping the sub-fields of a Gravity Forms address field to WooCommerce billing address fields on the customer. You can do the same with shipping address fields, or address fields in any other plugins that store customer address details as separate fields.

Saving an address for WooCommerce from a Gravity Forms User Registration feed

Enable save as code

The add-on settings has an option for converting the country name to its code value. Tick this option in the add-on settings to affect all forms:

Forms > Settings > Address Enhanced

Or you can turn on country code values for selected address fields, in the Advanced settings for each field.

Advanced settings: convert country name to code
Advanced settings: convert country name to code

By default, the states will be saved as short-form ISO standard codes (ISO 3166-2 subdivision), but you can choose to save them in other formats. For compatibility with WooCommerce, choose the WooCommerce state / province format.