How can I programmatically add data to an address field?
If you have a field with multiple properties then use an extra array:
$values = [
  'name' =&gt; $user[&quot;name&quot;],
  'pass' =&gt; '',
  'status' =&gt; $user[&quot;status&quot;],
  'mail' =&gt; $user[&quot;e_mail&quot;],

  'field_address' =&gt; [
    'first_name' =&gt; $user[&quot;first_name&quot;],
    'last_name' =&gt; $user[&quot;last_name&quot;],
    'city' =&gt; $city,
  ],
];