On save, in function addressfield_field_presave() item could (in some Drupal Commerce case) already have a name_line key, AND also a defined first_name & last_name keys.

We maybe must prevent erase first_name and lastname by testing if isset, for exemple line 474:

elseif (isset($item['name_line'])) {

change by

elseif (isset($item['name_line']) && !isset($item['first_name']) && !isset($item['last_name'])) {

the duplication on save problem appears for exemple, when we have a composed first name with space in commerce order save function, the test to check if original and new data are identical fail, due to erase by addressfield_field_presave() code :

      // Otherwise if the name line is set, separate it out into a best guess at
      // the first and last name.
      $names = explode(' ', $item['name_line']);

      $item['first_name'] = array_shift($names);
      $item['last_name'] = implode(' ', $names);

Comments

gregori.goossens created an issue.