migrate_merge_duplicated_terms
This module provides a plugin which dedupe taxonomy terms merging them into one during a migration.
If you have duplicated terms in a vocabulary you are about to migrate, this plugin will only migrate the first occurrence of a term, skip the other rows with the same name but it will map the migrated term id with every source id which has the same name (so if you have other content tagged with these skipped terms id, those content will be attached to the term id that has been migrated when you will use the migration_lookup).
If you want to merge different terms name into one during your migration, you just need to rename those terms in your source (database, csv, json, etc.) so that they have the same name, then use this plugin during the migration and that's all.
Requirements
This module requires the following modules:
- Taxonomy (Core module) must be enabled
- Migrate plus
Installation
Install as you would normally install a contributed Drupal module. Visit
https://www.drupal.org/node/1897420 for further information.
How to use it
Add the following lines in your migration yml file and just replace "source_field" & "vocabulary_id" by the values you need:
process:
name:
plugin: merge_duplicated_terms
source: source_field
destination:
plugin: 'entity:taxonomy_term'
default_bundle: vocabulary_id
Known issues
If the terms in your source have parents, please make sure to order your source so that you always have parents first and then children or you might have some of your terms attached to a wrong parent https://www.drupal.org/project/migrate_merge_duplicated_terms/issues/332...