{"id":39252,"date":"2016-01-08T17:14:27","date_gmt":"2016-01-08T17:14:27","guid":{"rendered":"http:\/\/webkul.com\/blog\/?p=39252"},"modified":"2024-02-21T11:37:12","modified_gmt":"2024-02-21T11:37:12","slug":"magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/","title":{"rendered":"Magento2- How to create product custom attribute from installer in custom module"},"content":{"rendered":"\n<p>Here we learn in Magento2 \u2013 How to create product custom attribute (Dropdown type) from the installer file in the custom module.<\/p>\n\n\n\n<p>Here we create a select type custom attribute in which options come from the option list file.<\/p>\n\n\n\n<p><strong>1=&gt;First we need to create an installer file named InstallData.php in our custom module Setup folder<\/strong><\/p>\n\n\n\n<p><strong>&nbsp;complete path<\/strong>: app\/code\/ModuleNameSpace\/YourModuleName\/Setup<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\nnamespace ModuleNameSpace\\YourModuleName\\Setup;\n\nuse Magento\\Eav\\Setup\\EavSetup; \nuse Magento\\Eav\\Setup\\EavSetupFactory \/* For Attribute create  *\/;\nuse Magento\\Framework\\Setup\\InstallDataInterface;\nuse Magento\\Framework\\Setup\\ModuleContextInterface;\nuse Magento\\Framework\\Setup\\ModuleDataSetupInterface;\n\n\/**\n * @codeCoverageIgnore\n *\/\nclass InstallData implements InstallDataInterface\n{\n    \/**\n     * EAV setup factory\n     *\n     * @var EavSetupFactory\n     *\/\n    private $eavSetupFactory;\n    \/**\n     * Init\n     *\n     * @param EavSetupFactory $eavSetupFactory\n     *\/\n    public function __construct(EavSetupFactory $eavSetupFactory)\n    {\n        $this-&gt;eavSetupFactory = $eavSetupFactory; \n        \/* assign object to class global variable for use in other class methods *\/\n    }\n\n    \/**\n     * {@inheritdoc}\n     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)\n     *\/\n    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)\n    {\n        \/** @var EavSetup $eavSetup *\/\n        $eavSetup = $this-&gt;eavSetupFactory-&gt;create(&#091;&#039;setup&#039; =&gt; $setup]);\n        \n        \/**\n         * Add attributes to the eav\/attribute\n         *\/\n        $eavSetup-&gt;removeAttribute(\\Magento\\Catalog\\Model\\Product::ENTITY,&#039;yourcustomattribute_id&#039;);\n        $eavSetup-&gt;addAttribute(\n            \\Magento\\Catalog\\Model\\Product::ENTITY,\n            &#039;yourcustomattribute_id&#039;,\/* Custom Attribute Code *\/\n            &#091;\n                &#039;group&#039; =&gt; &#039;Product Details&#039;,\/* Group name in which you want \n\t\t\t\t\t\t\t\t\t\t\t  to display your custom attribute *\/\n                &#039;type&#039; =&gt; &#039;int&#039;,\/* Data type in which formate your value save in database*\/\n                &#039;backend&#039; =&gt; &#039;&#039;,\n                &#039;frontend&#039; =&gt; &#039;&#039;,\n                &#039;label&#039; =&gt; &#039;Your Custom Attribute Label&#039;, \/* label of your attribute*\/\n                &#039;input&#039; =&gt; &#039;select&#039;,\n                &#039;class&#039; =&gt; &#039;&#039;,\n                &#039;source&#039; =&gt; &#039;ModuleNameSpace\\YourModuleName\\Model\\Config\\Source\\Options&#039;,\n\t\t\t\t\t\t\t\t\/* Source of your select type custom attribute options*\/\n                &#039;global&#039; =&gt; \\Magento\\Eav\\Model\\Entity\\Attribute\\ScopedAttributeInterface::SCOPE_GLOBAL,\n\t\t\t\t\t\t\t\t\t\/*Scope of your attribute *\/\n                &#039;visible&#039; =&gt; true,\n                &#039;required&#039; =&gt; true,\n                &#039;user_defined&#039; =&gt; false,\n                &#039;default&#039; =&gt; &#039;&#039;,\n                &#039;searchable&#039; =&gt; false,\n                &#039;filterable&#039; =&gt; false,\n                &#039;comparable&#039; =&gt; false,\n                &#039;visible_on_front&#039; =&gt; false,\n                &#039;used_in_product_listing&#039; =&gt; true,\n                &#039;unique&#039; =&gt; false\n            ]\n        );\n    }\n}<\/pre>\n\n\n\n<p><strong>2=&gt; Now we create option source file class Options for the custom attribute options list<\/strong><\/p>\n\n\n\n<p><strong>File Name<\/strong>&#8211; Options.php<\/p>\n\n\n\n<p><strong>File Path<\/strong>&#8211; app\/code\/ModuleNameSpace\/YourModuleName\/Model\/Config\/Source<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\nnamespace ModuleNameSpace\\YourModuleName\\Model\\Config\\Source;\n\nuse Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\OptionFactory;\nuse Magento\\Framework\\DB\\Ddl\\Table;\n\n\/**\n * Custom Attribute Renderer\n *\n * @author      Webkul Core Team &lt;support@webkul.com&gt;\n *\/\nclass Options extends \\Magento\\Eav\\Model\\Entity\\Attribute\\Source\\AbstractSource\n{\n    \/**\n     * @var OptionFactory\n     *\/\n    protected $optionFactory;\n\n    \/**\n     * @param OptionFactory $optionFactory\n     *\/\n    \/*public function __construct(OptionFactory $optionFactory)\n    {\n        $this-&gt;optionFactory = $optionFactory;  \n        \/\/you can use this if you want to prepare options dynamically  \n    }*\/\n\n    \/**\n     * Get all options\n     *\n     * @return array\n     *\/\n    public function getAllOptions()\n    {\n\t\t\/* your Attribute options list*\/\n        $this-&gt;_options=&#091; &#091;&#039;label&#039;=&gt;&#039;Select Options&#039;, &#039;value&#039;=&gt;&#039;&#039;],\n\t\t\t\t\t\t  &#091;&#039;label&#039;=&gt;&#039;Option1&#039;, &#039;value&#039;=&gt;&#039;1&#039;],\n\t\t\t\t\t\t  &#091;&#039;label&#039;=&gt;&#039;Option2&#039;, &#039;value&#039;=&gt;&#039;2&#039;],\n\t\t\t\t\t\t  &#091;&#039;label&#039;=&gt;&#039;Option3&#039;, &#039;value&#039;=&gt;&#039;3&#039;]\n\t\t\t\t\t\t ];\n        return $this-&gt;_options;\n    }\n\n    \/**\n     * Get a text for option value\n     *\n     * @param string|integer $value\n     * @return string|bool\n     *\/\n    public function getOptionText($value)\n    {\n        foreach ($this-&gt;getAllOptions() as $option) {\n            if ($option&#091;&#039;value&#039;] == $value) {\n                return $option&#091;&#039;label&#039;];\n            }\n        }\n        return false;\n    }\n\n    \/**\n     * Retrieve flat column definition\n     *\n     * @return array\n     *\/\n    public function getFlatColumns()\n    {\n        $attributeCode = $this-&gt;getAttribute()-&gt;getAttributeCode();\n        return &#091;\n            $attributeCode =&gt; &#091;\n                &#039;unsigned&#039; =&gt; false,\n                &#039;default&#039; =&gt; null,\n                &#039;extra&#039; =&gt; null,\n                &#039;type&#039; =&gt; Table::TYPE_INTEGER,\n                &#039;nullable&#039; =&gt; true,\n                &#039;comment&#039; =&gt; &#039;Custom Attribute Options  &#039; . $attributeCode . &#039; column&#039;,\n            ],\n        ];\n    }\n}<\/pre>\n\n\n\n<p>After adding these files install your custom module in your magento2 instance<\/p>\n\n\n\n<p>then by terminal run the following command in your magento2 root directory<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">php bin\/magento setup:upgrade<\/pre>\n\n\n\n<p><strong>Now, your product create page will open with your custom attribute as following \ud83d\ude42<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1287\" height=\"625\" src=\"http:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_055.png\" alt=\"Selection_055\" class=\"wp-image-39258\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_055.png 1287w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_055-250x121.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_055-300x146.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_055-768x373.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Selection_055-1200x583.png 1200w\" sizes=\"(max-width: 1287px) 100vw, 1287px\" loading=\"lazy\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Here we learn in Magento2 \u2013 How to create product custom attribute (Dropdown type) from the installer file in the custom module. Here we create a select type custom attribute in which options come from the option list file. 1=&gt;First we need to create an installer file named InstallData.php in our custom module Setup folder <a href=\"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":4,"featured_media":39259,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,302],"tags":[1230,1908,2580,580,1909],"class_list":["post-39252","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-magento","category-magento2","tag-custom-attribute","tag-dropdown","tag-installer","tag-product","tag-select"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Magento2- How to create product custom attribute from installer in custom module - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Magento2- How to create product custom attribute from installer in custom module - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Here we learn in Magento2 \u2013 How to create product custom attribute (Dropdown type) from the installer file in the custom module. Here we create a select type custom attribute in which options come from the option list file. 1=&gt;First we need to create an installer file named InstallData.php in our custom module Setup folder [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2016-01-08T17:14:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-21T11:37:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"825\" \/>\n\t<meta property=\"og:image:height\" content=\"260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Abhishek Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Abhishek Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/\"},\"author\":{\"name\":\"Abhishek Singh\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/573e459f54796eb4195511990de4bfd0\"},\"headline\":\"Magento2- How to create product custom attribute from installer in custom module\",\"datePublished\":\"2016-01-08T17:14:27+00:00\",\"dateModified\":\"2024-02-21T11:37:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/\"},\"wordCount\":142,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-1.png\",\"keywords\":[\"custom attribute\",\"dropdown\",\"installer\",\"product\",\"select\"],\"articleSection\":[\"magento\",\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/\",\"url\":\"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/\",\"name\":\"Magento2- How to create product custom attribute from installer in custom module - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-1.png\",\"datePublished\":\"2016-01-08T17:14:27+00:00\",\"dateModified\":\"2024-02-21T11:37:12+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-1.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-1.png\",\"width\":825,\"height\":260,\"caption\":\"image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Magento2- How to create product custom attribute from installer in custom module\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/573e459f54796eb4195511990de4bfd0\",\"name\":\"Abhishek Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d4ac7e0e671bf743359d7e3f140c262d1b16d71106f0a1aeaecca327a2805ae4?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d4ac7e0e671bf743359d7e3f140c262d1b16d71106f0a1aeaecca327a2805ae4?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Abhishek Singh\"},\"description\":\"Adobe Commerce certified Magento developer with over 12 years of experience at Webkul. Passionate about scalable Magento 2-based webshops, AI, and multi-channel integrations, Abhishek consistently delivers innovative and efficient e-commerce solutions that propel businesses forward.\",\"sameAs\":[\"http:\/\/webkul.com\"],\"url\":\"https:\/\/webkul.com\/blog\/author\/abhishek\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Magento2- How to create product custom attribute from installer in custom module - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/","og_locale":"en_US","og_type":"article","og_title":"Magento2- How to create product custom attribute from installer in custom module - Webkul Blog","og_description":"Here we learn in Magento2 \u2013 How to create product custom attribute (Dropdown type) from the installer file in the custom module. Here we create a select type custom attribute in which options come from the option list file. 1=&gt;First we need to create an installer file named InstallData.php in our custom module Setup folder [...]","og_url":"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2016-01-08T17:14:27+00:00","article_modified_time":"2024-02-21T11:37:12+00:00","og_image":[{"width":825,"height":260,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-1.png","type":"image\/png"}],"author":"Abhishek Singh","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Abhishek Singh","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/"},"author":{"name":"Abhishek Singh","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/573e459f54796eb4195511990de4bfd0"},"headline":"Magento2- How to create product custom attribute from installer in custom module","datePublished":"2016-01-08T17:14:27+00:00","dateModified":"2024-02-21T11:37:12+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/"},"wordCount":142,"commentCount":2,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-1.png","keywords":["custom attribute","dropdown","installer","product","select"],"articleSection":["magento","Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/","url":"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/","name":"Magento2- How to create product custom attribute from installer in custom module - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-1.png","datePublished":"2016-01-08T17:14:27+00:00","dateModified":"2024-02-21T11:37:12+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-1.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/01\/Magneto-Code-Snippet-1.png","width":825,"height":260,"caption":"image"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/magento2-how-to-create-product-custom-attribute-from-installer-in-custom-module\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Magento2- How to create product custom attribute from installer in custom module"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/573e459f54796eb4195511990de4bfd0","name":"Abhishek Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d4ac7e0e671bf743359d7e3f140c262d1b16d71106f0a1aeaecca327a2805ae4?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d4ac7e0e671bf743359d7e3f140c262d1b16d71106f0a1aeaecca327a2805ae4?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Abhishek Singh"},"description":"Adobe Commerce certified Magento developer with over 12 years of experience at Webkul. Passionate about scalable Magento 2-based webshops, AI, and multi-channel integrations, Abhishek consistently delivers innovative and efficient e-commerce solutions that propel businesses forward.","sameAs":["http:\/\/webkul.com"],"url":"https:\/\/webkul.com\/blog\/author\/abhishek\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/39252","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=39252"}],"version-history":[{"count":10,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/39252\/revisions"}],"predecessor-version":[{"id":423460,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/39252\/revisions\/423460"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media\/39259"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=39252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=39252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=39252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}