Create Attribute following way :-
$eavSetup->updateAttribute(
\Magento\Catalog\Model\Product::ENTITY, 'custom_attribute_name',
[
'type' => 'int',
'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend',
'frontend' => '',
'label' => 'Custom Attribute Name',
'input' => 'boolean',
'group' => 'General',
'class' => 'custom_attribute_name',
'source' => 'Custom\Product\Model\YesNo',
'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => true,
'user_defined' => false,
'default' => '1',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false
]
);
After you add options like. Create File Custom\Product\Model\YesNo
For Options
<?php
namespace Yourvendorname\Yourmodulename\Model;
class YesNo extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
{
protected $_options;
public function toOptionArray()
{
return array(
array('value' => '1', 'label' => __('Yes')),
array('value' => '0', 'label' => __('No'))
..................
);
}
public function getAllOptions()
{
return $this->toOptionArray();
}
}
You Can Add Options In toOptionArray() Function
THANKS.