Skip to content

Instantly share code, notes, and snippets.

@paugnu
Last active April 20, 2017 04:54
Show Gist options
  • Save paugnu/0e2e26e8d672ff8f695f0cce8cb70310 to your computer and use it in GitHub Desktop.
Save paugnu/0e2e26e8d672ff8f695f0cce8cb70310 to your computer and use it in GitHub Desktop.
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