The address_default widget will remove any existing field data passed to the widget if the entity is new. This prevents creating an entity stub and prepopulating its values impossible unless you use the AddressEvents::INITIAL_VALUES. In most cases this is fine, but it is not practical when creating a duplicate of an entity.
This was discovered while working on #3022850: [Addressbook, part 1] Rework the ownership model for customer profiles. This can be replicated by creating a profile, running ::createDuplicate and then passing it to an entity form.
\Drupal\address\Plugin\Field\FieldWidget\AddressDefaultWidget::getInitialValues should support a parameter of array $existing_values = NULL and be passed the current item's values.
Example:
protected function getInitialValues(array $existing_values) {
$default_country = $this->getSetting('default_country');
$item = $items[$delta];
$value = $item->getEntity()->isNew() ? $this->getInitialValues($item->toArray()) : $item->toArray();
Comments
Comment #2
bojanz commentedSee #2838457: Re-enable the default value functionality for Address fields.