commerce_export-8.x-1.0-alpha1/config/install/migrate_plus.migration.import_taxonomy_term.yml
config/install/migrate_plus.migration.import_taxonomy_term.yml
# Import taxonomy terms for existing vocabularies.
#
# Taxonomy is imported in vocabulary/term pairs. Up to 3 pairs per row can be
# imported with this migration. The text in the vocabulary column is expected to
# the be the same for that entire column. The term should be whatever is
# required for the product variation in that row.
#
# The vocabulary/term pair will only be saved when both values are not empty.
#
# Destination site configuration:
# - Install the Taxonomy Module.
# - Create the vocabularies.
#
id: import_taxonomy_term
label: Taxonomy terms
migration_group: commerce_export
source:
plugin: taxonomy_term_csv
path: 'public://import/product.csv'
header_row_count: 1
enclosure: '"'
keys:
- vocabulary_name
- term
column_names:
7:
vocabulary_name1: 'Vocabulary1'
8:
term1: 'Vocabulary value1'
9:
vocabulary_name2: 'Vocabulary2'
10:
term2: 'Vocabulary value2'
11:
vocabulary_name3: 'Vocabulary3'
12:
term3: 'Vocabulary value3'
process:
# The vocabulary/term pair will only be saved when both are not empty.
# Vocabulary ID is limited to 32 character. The row is skipped if the input value is empty.
vid:
-
plugin: machine_name
source: vocabulary_name
-
plugin: skip_on_empty
method: row
-
plugin: substr
length: 32
# Skip the row if the term is empty.
name:
plugin: skip_on_empty
source: term
method: row
destination:
plugin: entity:taxonomy_term
