0

I'm trying to map multiple existing terms using their target_id values to an entity (Commerce Product) and I can only get the first value to map.

My yml file looks like this:

  'field_prod_category/target_id':
    plugin: explode
    source: tid
    delimiter: ','

And, for now, I'm hard coding two existing term ID values in through the source plugin like so:

$row->setSourceProperty('tid', '806,635');

But no matter what I try only the first term is referenced. And, yes, the term field is set to unlimited.

Any ideas?

0

You need to use plugin sub_process. File yml have soure like this:

  field_prod_category:
    plugin: sub_process
    source: tids
    process:
      target_id: tid

and soure plugin need to prepare:

$tids = [
      'tid' => 806,
      'tid' => 635
    ];
$row->setSourceProperty('tids', $tids);

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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