I am working on to create a simple product programmatically.

I have created 2 custom Attribute

  1. Select(select_testing)
  2. MultiSelect(multiselect_testing)

select_testing attribute value ==> 1, 2, ,3, 4. multiselect_testing attribute value --> 1, 2, 3, 4.

So, I try to add Product using following code.

  $_objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // instance of object manager
  $simple_product = $_objectManager->create('\Magento\Catalog\Model\Product');
  $simple_product->setRkTesting('Rk Testing');

But, Select and Multiselect attribute value not save.

Suggest me, how to add Select and multiselect Attribute value.

2 Answers 2


You should use


as 'backend_model' for your "multiple" attribute

and update attribute by follow:

$_product->addAttributeUpdate('attribute_code', 'value', $storeId);

You have to pass the values comma separated not array. $simple_product->setMultiselectTesting('1,2,3');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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