Running through some needed updates on an eCommerce site we run, we ran into an unexpected snag with Addressfield that we even missed in our pre-deployment testing. Since we missed it in testing and it creates a special situation in Drupal websites I thought I would post a quick blog on what happened.
The newest version of Addressfield comes with a new requirement for certain fields within an address to be required. This was done to keep from having partial address data in your records. This created a problem. The sub-fields of the Addressfield have been marked as required forcing any form with an Addressfield field type to require the fields have data in them, even through the Addressfield as a whole is marked as not required. This of course caused issues instantly for anyone using the Addressfield in their Drupal installation for things other than commerce. In our case we use the Addressfield added to the user record to save demographics on all users, but we do not require this data. Additionally we set the default country for this field to cater to the majorigy of our users. Setting a default loads the Addressfield widget with required fields in the form. With the new update to Addressfield creating this behavior users could no longer update their profile or even change their password without providing address data if it was not already there.
As expected, there were other people with the same issue. This issue in Addressfield documents other people having the same problem and generated a patch to allow setting the sub-fields to not be required.