I am currently searching for a example to migrate data into an address field in Drupal 8 without any luck for now.

Has someone a hint for me on how to map the fields?

I tried the following:

my.migrate.yml file:

'field_date_address/address_line1': date_tmp_address_address_line1
'field_date_address/locality': date_tmp_address_locality
'field_date_address/postal_code': date_tmp_address_postal_code


$row->setSourceProperty('date_tmp_address_address_line1', 'Teststreet 18');
$row->setSourceProperty('date_tmp_address_locality', 'Test locallity');
$row->setSourceProperty('date_tmp_address_postal_code', '12345');

I was able to solve it :-)

This helped me: https://www.drupal.org/node/2594631#comment-11322879

It is important to map all addressfield subfields, otherwise it will not work.

  • 3
    If you can post an example here rather then only a link, it would be better. – Jimmy Ko Jul 30 '16 at 14:54
  • To have duplicate content? I do not think that is a good idea. – Sebastian Nov 29 '16 at 17:00
  • 2
    It is not a shame if you provide the link where you copy from. Because the 3rd party source can be not found in future. It is encouraged in Drupal Answer and also Stackoverflow. – Jimmy Ko Nov 29 '16 at 17:21
  • 1
    Just to elaborate on Sebastian's comment. If you try and just migrate one field (say address_line1) it will not work. You need to migrate all the fields (or at least address_line1, country_code, langcode, locality, postal_code and administrative_area). I got stuck on this for quite a while. – chap May 4 '18 at 1:34

I do migrate from json to drupal 8, hope this will help.

In the .yml I call the field on a single value :

id: my_id_migrate
label: My Label
migration_group: MyGroup
migration_dependencies: {}

  plugin: json_source
    Accept: 'application/json'
  identifier: id
  identifierDepth: 0
    - id
    - title
    - address

  plugin: entity:node

    plugin: default_value
    default_value: my_node_type

  title: title

  field_geolocation : geolocation
  field_address : address

And 'address' is an array of all subfields :

.json source :

      "title":"Title 1",
         "address_line1":"adress 1",
         "locality":"City of lights",
      "title":"Title 2",
         "address_line1":"adress 1 of number2",
         "locality":"City of lights",
      "title":"Title 3",
         "address_line1":"adress 1 of number3",
         "locality":"City of lights",

Works with all subfields, and works fine for all fields in drupal 8 that have subfields (like geolocation fields for example)


Can you please give any example any example we can have for Source migration as SQL Currently I am facing a issue in migration addressfield from Drupal 7 to Drupal 8 Address field

There are no migration path currently for Address field any suggestion will be helpful


Here is a working example with a user profile migration (not Drupal user account).

Adress is an array of subfields. You can check in database all the possible subfields because i don’t use all of them (ex : field_profile_address_family_name)

.yml file :

     plugin: default_value
     default_value: FR
     plugin: default_value
     default_value: fr
   field_profile_address/address_line1: adresse1
   field_profile_address/address_line1: adresse2
   field_profile_address/locality: ville

   field_profile_address/postal_code: code_postal

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.