You are here

csv_example_taxonomy_term.yml in Commerce Migrate 3.1.x

modules/csv_example/migrations/csv_example_taxonomy_term.yml

File

modules/csv_example/migrations/csv_example_taxonomy_term.yml
View source
  1. # Import taxonomy terms for existing vocabularies.
  2. #
  3. # Taxonomy is imported in vocabulary/term pairs. Up to 3 pairs per row can be
  4. # imported with this migration. The text in the vocabulary column is expected to
  5. # the be the same for that entire column. The term should be whatever is
  6. # required for the product variation in that row.
  7. #
  8. # The vocabulary/term pair will only be saved when both values are not empty.
  9. #
  10. # Destination site configuration:
  11. # - Install the Taxonomy Module.
  12. # - Create the vocabularies.
  13. #
  14. id: csv_example_taxonomy_term
  15. label: Taxonomy terms
  16. migration_group: commerce_migrate_csv_example
  17. migration_tags:
  18. - Commerce CSV
  19. - Content
  20. source:
  21. plugin: csv_example_taxonomy_term
  22. path: 'public://import/example-products.csv'
  23. enclosure: "\""
  24. header_offset: 0
  25. ids: [vocabulary_name, term]
  26. fields:
  27. - name: title
  28. label: Title
  29. - name: sku
  30. label: SKU
  31. - name: status
  32. label: Status
  33. - name: product_type
  34. label: Product type
  35. - name: description
  36. label: Description
  37. - name: product_variation_type
  38. label: Product variation type
  39. - name: sell_price
  40. label: Sell price
  41. - name: vocabulary_name1
  42. label: Vocabulary1
  43. - name: term1
  44. label: Vocabulary value1
  45. - name: vocabulary_name2
  46. label: Vocabulary2
  47. - name: term2
  48. label: Vocabulary value2
  49. - name: vocabulary_name3
  50. label: Vocabulary3
  51. - name: term3
  52. label: Vocabulary value3
  53. process:
  54. # The vocabulary/term pair will only be saved when both are not empty.
  55. # Vocabulary ID is limited to 32 character.
  56. vid:
  57. -
  58. plugin: machine_name
  59. source: vocabulary_name
  60. -
  61. plugin: skip_on_empty
  62. method: row
  63. -
  64. plugin: substr
  65. length: 32
  66. # Skip the row if the term is empty.
  67. name:
  68. plugin: skip_on_empty
  69. source: term
  70. method: row
  71. destination:
  72. plugin: entity:taxonomy_term