I am trying to create products programmatically. In the task, I need to set the multiselect attribute options. I tried like below, but it is not working.
$optionIds[] = $optionId; //$optionIds = array(41,42,43)
$product->setData($attributeCode, $optionIds);
But it is not working. I don't know what I am doing wrong. Can anyone help on this?