Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
searchable_attribute.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 $eavSetupFactory = $objectManager->create(\Magento\Eav\Setup\EavSetupFactory::class);
12 $eavSetup->addAttribute(
13  \Magento\Catalog\Model\Product::ENTITY,
14  'test_searchable_attribute',
15  [
16  'label' => 'Test-attribute',
17  'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE,
18  'required' => 0,
19  'user_defined' => 1,
20  'searchable' => 1,
21  'visible_on_front' => 1,
22  'filterable_in_search' => 1,
23  'used_in_product_listing' => 1,
24  'is_used_in_grid' => 1,
25  'is_filterable_in_grid' => 1,
26  ]
27 );
$eavSetupFactory