Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Magento 2: Create multiselect product attribute
<?php
['code' => 'code_of_the_attribute',
'attribute_set' => '*',
'label' => 'Concern',
'attribute_group' => 'Extra Content',
'type' => 'text',
'input' => 'multiselect',
'option' => ['values' => [
'Option 1',
'Option 2',
'Option 3',
],
],
'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend',
'unit' => '',
'required' => false,
'visible' => true,
'visible_on_front' => false,
'sort_order' => 2,
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
'searchable' => true,
'filterable' => true,
'used_for_promo_rule' => true,
'comparable' => false,
'wysiwyg_enabled' => false,
'used_in_product_listing' => false,
'used_for_sort_by' => false, ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment