{"id":370821,"date":"2023-02-28T09:13:38","date_gmt":"2023-02-28T09:13:38","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=370821"},"modified":"2023-05-26T05:49:05","modified_gmt":"2023-05-26T05:49:05","slug":"add-custom-product-attributes-in-magento-2","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/","title":{"rendered":"Add custom product attributes for different product types in Magento2"},"content":{"rendered":"\n<p>In this blog, we are going to learn how we can add custom product attributes for different product types. <\/p>\n\n\n\n<p><strong>Example<\/strong>:- <strong><em>Custom Attribute 1<\/em> <\/strong>for Simple Product, <strong><em>Custom Attribute 2<\/em> <\/strong> for Configurable Product, <strong><em>Custom Attribute 3<\/em> <\/strong> for Bundle Product, and so on for other Products.<\/p>\n\n\n\n<p>Here, in the following example, I have added some <a href=\"https:\/\/experienceleague.adobe.com\/docs\/commerce-learn\/tutorials\/backend-development\/add-product-attribute.html?lang=en\">custom attributes<\/a> for different product types.<\/p>\n\n\n\n<p>Please follow the below steps to achieve the desired result.<\/p>\n\n\n\n<p><strong>Step 1:<\/strong>&nbsp;Create&nbsp;CustomProductAttributes.php file inside the&nbsp;<strong><em>app\/code\/Vendor\/Module\/Setup\/<\/em>&nbsp;Patch\/Data\/ <\/strong>directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_CustomProductAttributes\n * @author    Webkul Software Private Limited\n * @copyright Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\nnamespace Webkul\\CustomProductAttributes\\Setup\\Patch\\Data;\n\nuse Magento\\Framework\\Setup\\Patch\\DataPatchInterface;\nuse Magento\\Framework\\Setup\\ModuleDataSetupInterface;\nuse Magento\\Eav\\Model\\Config as EavConfig;\nuse Magento\\Eav\\Setup\\EavSetupFactory;\nuse Magento\\Eav\\Model\\Entity\\Attribute\\SetFactory;\nuse Magento\\Catalog\\Model\\Product;\nuse Magento\\Eav\\Model\\Entity\\Attribute\\ScopedAttributeInterface;\n\nclass CustomProductAttributes implements DataPatchInterface\n{\n    \/**\n     * @var \\Magento\\Framework\\Setup\\ModuleDataSetupInterface\n     *\/\n    private $moduleDataSetup;\n\n    \/**\n     * @var \\Magento\\Eav\\Model\\Config\n     *\/\n    private $eavConfig;\n\n    \/**\n     * @var \\Magento\\Eav\\Setup\\EavSetupFactory;\n     *\/\n    private $eavSetupFactory;\n    \n    \/**\n     * @var \\Magento\\Eav\\Model\\Entity\\Attribute\\SetFactory\n     *\/\n    private $attributeSetFactory;\n\n    \/**\n     * Constructor\n     *\n     * @param ModuleDataSetupInterface $moduleDataSetup\n     * @param EavConfig $eavConfig\n     * @param EavSetupFactory $eavSetupFactory\n     * @param SetFactory $attributeSetFactory\n     *\/\n    public function __construct(\n        ModuleDataSetupInterface $moduleDataSetup,\n        EavConfig $eavConfig,\n        EavSetupFactory $eavSetupFactory,\n        SetFactory $attributeSetFactory\n    ) {\n        $this-&gt;moduleDataSetup = $moduleDataSetup;\n        $this-&gt;eavConfig = $eavConfig;\n        $this-&gt;eavSetupFactory = $eavSetupFactory;\n        $this-&gt;attributeSetFactory = $attributeSetFactory;\n    }\n\n    \/**\n     * Do Upgrade\n     *\n     * @return void\n     *\/\n    public function apply()\n    {\n        $this-&gt;moduleDataSetup-&gt;getConnection()-&gt;startSetup();\n\n        $eavSetup = $this-&gt;eavSetupFactory-&gt;create(&#091;&#039;setup&#039; =&gt; $this-&gt;moduleDataSetup]);\n        \/** creating attribute for simple products  *\/\n        $eavSetup-&gt;addAttribute(\n            \\Magento\\Catalog\\Model\\Product::ENTITY,\n            &#039;custom_attr_simple&#039;,\n            &#091;\n                &#039;type&#039; =&gt; &#039;text&#039;,\n                &#039;backend&#039; =&gt; &#039;&#039;,\n                &#039;frontend&#039; =&gt; &#039;&#039;,\n                &#039;label&#039; =&gt; &#039;Custom Attribute 1&#039;,\n                &#039;input&#039; =&gt; &#039;text&#039;,\n                &#039;class&#039; =&gt; &#039;&#039;,\n                &#039;source&#039; =&gt; &#039;&#039;,\n                &#039;global&#039; =&gt; \\Magento\\Eav\\Model\\Entity\\Attribute\\ScopedAttributeInterface::SCOPE_GLOBAL,\n                &#039;visible&#039; =&gt; true,\n                &#039;required&#039; =&gt; false,\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                &#039;apply_to&#039; =&gt; &#039;simple&#039;\n            ]\n        );\n\n        \/** creating attribute for configurable products *\/\n        $eavSetup-&gt;addAttribute(\n            \\Magento\\Catalog\\Model\\Product::ENTITY,\n            &#039;custom_attr_configurable&#039;,\n            &#091;\n                &#039;type&#039; =&gt; &#039;text&#039;,\n                &#039;backend&#039; =&gt; &#039;&#039;,\n                &#039;frontend&#039; =&gt; &#039;&#039;,\n                &#039;label&#039; =&gt; &#039;Custom Attribute 2&#039;,\n                &#039;input&#039; =&gt; &#039;text&#039;,\n                &#039;class&#039; =&gt; &#039;&#039;,\n                &#039;source&#039; =&gt; &#039;&#039;,\n                &#039;global&#039; =&gt; \\Magento\\Eav\\Model\\Entity\\Attribute\\ScopedAttributeInterface::SCOPE_GLOBAL,\n                &#039;visible&#039; =&gt; true,\n                &#039;required&#039; =&gt; false,\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                &#039;apply_to&#039; =&gt; &#039;configurable&#039;\n            ]\n        );\n\n        \/** creating attribute for bundle products *\/\n        $eavSetup-&gt;addAttribute(\n            \\Magento\\Catalog\\Model\\Product::ENTITY,\n            &#039;custom_attr_bundle&#039;,\n            &#091;\n                &#039;type&#039; =&gt; &#039;text&#039;,\n                &#039;backend&#039; =&gt; &#039;&#039;,\n                &#039;frontend&#039; =&gt; &#039;&#039;,\n                &#039;label&#039; =&gt; &#039;Custom Attribute 3&#039;,\n                &#039;input&#039; =&gt; &#039;text&#039;,\n                &#039;class&#039; =&gt; &#039;&#039;,\n                &#039;source&#039; =&gt; &#039;&#039;,\n                &#039;global&#039; =&gt; \\Magento\\Eav\\Model\\Entity\\Attribute\\ScopedAttributeInterface::SCOPE_GLOBAL,\n                &#039;visible&#039; =&gt; true,\n                &#039;required&#039; =&gt; false,\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                &#039;apply_to&#039; =&gt; &#039;bundle&#039;\n            ]\n        );\n    }\n\n    \/**\n     * @inheritdoc\n     *\/\n    public function getAliases()\n    {\n        return &#091;];\n    }\n\n    \/**\n     * @inheritdoc\n     *\/\n    public static function getDependencies()\n    {\n        return &#091;];\n    }\n}<\/pre>\n\n\n\n<p><strong>Step 2:<\/strong>&nbsp;Now, just run the below upgrade command.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">php bin\/magento setup:upgrade<\/pre>\n\n\n\n<p>Now, look into the first image in which <strong>Custom Attribute 1<\/strong>&nbsp;is being displayed for Simple Products Only. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"641\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/first-image-1200x641.png\" alt=\"add custom product attributes\" class=\"wp-image-370886\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/first-image-1200x641.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/first-image-300x160.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/first-image-250x134.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/first-image-768x410.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/first-image.png 1297w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>Look into the second image in which <strong>Custom Attribute 2 <\/strong>is being displayed for Configurable Products only.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"497\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/second-image-1200x497.png\" alt=\"add custom product attributes\" class=\"wp-image-370888\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/second-image-1200x497.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/second-image-300x124.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/second-image-250x103.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/second-image-768x318.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/second-image.png 1300w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>And in the last image in which <strong>Custom Attribute 3 <\/strong>is being displayed for Bundle Products only.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"547\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/third-image-1200x547.png\" alt=\"add custom product attributes\" class=\"wp-image-370889\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/third-image-1200x547.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/third-image-300x137.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/third-image-250x114.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/third-image-768x350.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/third-image.png 1306w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>Hope this will be helpful.<\/p>\n\n\n\n<p>Thanks \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog, we are going to learn how we can add custom product attributes for different product types. Example:- Custom Attribute 1 for Simple Product, Custom Attribute 2 for Configurable Product, Custom Attribute 3 for Bundle Product, and so on for other Products. Here, in the following example, I have added some custom attributes <a href=\"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":354,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[302],"tags":[13678],"class_list":["post-370821","post","type-post","status-publish","format-standard","hentry","category-magento2","tag-add-custom-product-attributes"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Add custom product attributes for different product types in Magento2<\/title>\n<meta name=\"description\" content=\"we are going to learn how we can add custom product attributes for specific product types in Magento 2. I have added some custom attributes for different product types.\" \/>\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\/add-custom-product-attributes-in-magento-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Add custom product attributes for different product types in Magento2\" \/>\n<meta property=\"og:description\" content=\"we are going to learn how we can add custom product attributes for specific product types in Magento 2. I have added some custom attributes for different product types.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/\" \/>\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=\"2023-02-28T09:13:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-26T05:49:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/02\/first-image-1200x641.png\" \/>\n<meta name=\"author\" content=\"Mubarik\" \/>\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=\"Mubarik\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/\"},\"author\":{\"name\":\"Mubarik\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/2fa581764e96125af674349150b2b818\"},\"headline\":\"Add custom product attributes for different product types in Magento2\",\"datePublished\":\"2023-02-28T09:13:38+00:00\",\"dateModified\":\"2023-05-26T05:49:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/\"},\"wordCount\":161,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/02\/first-image-1200x641.png\",\"keywords\":[\"add custom product attributes\"],\"articleSection\":[\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/\",\"url\":\"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/\",\"name\":\"Add custom product attributes for different product types in Magento2\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/02\/first-image-1200x641.png\",\"datePublished\":\"2023-02-28T09:13:38+00:00\",\"dateModified\":\"2023-05-26T05:49:05+00:00\",\"description\":\"we are going to learn how we can add custom product attributes for specific product types in Magento 2. I have added some custom attributes for different product types.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/first-image.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/first-image.png\",\"width\":1297,\"height\":693,\"caption\":\"first-image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Add custom product attributes for different product types in Magento2\"}]},{\"@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\/2fa581764e96125af674349150b2b818\",\"name\":\"Mubarik\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/af8c0b8b43a042ae4d9fd3cb5207b18bbe898d7ab63344df28ac22803b26a0ee?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\/af8c0b8b43a042ae4d9fd3cb5207b18bbe898d7ab63344df28ac22803b26a0ee?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Mubarik\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/md-mubarik459\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Add custom product attributes for different product types in Magento2","description":"we are going to learn how we can add custom product attributes for specific product types in Magento 2. I have added some custom attributes for different product types.","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\/add-custom-product-attributes-in-magento-2\/","og_locale":"en_US","og_type":"article","og_title":"Add custom product attributes for different product types in Magento2","og_description":"we are going to learn how we can add custom product attributes for specific product types in Magento 2. I have added some custom attributes for different product types.","og_url":"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2023-02-28T09:13:38+00:00","article_modified_time":"2023-05-26T05:49:05+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/02\/first-image-1200x641.png","type":"","width":"","height":""}],"author":"Mubarik","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Mubarik","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/"},"author":{"name":"Mubarik","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/2fa581764e96125af674349150b2b818"},"headline":"Add custom product attributes for different product types in Magento2","datePublished":"2023-02-28T09:13:38+00:00","dateModified":"2023-05-26T05:49:05+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/"},"wordCount":161,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/02\/first-image-1200x641.png","keywords":["add custom product attributes"],"articleSection":["Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/","url":"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/","name":"Add custom product attributes for different product types in Magento2","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/02\/first-image-1200x641.png","datePublished":"2023-02-28T09:13:38+00:00","dateModified":"2023-05-26T05:49:05+00:00","description":"we are going to learn how we can add custom product attributes for specific product types in Magento 2. I have added some custom attributes for different product types.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/first-image.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/02\/first-image.png","width":1297,"height":693,"caption":"first-image"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/add-custom-product-attributes-in-magento-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Add custom product attributes for different product types in Magento2"}]},{"@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\/2fa581764e96125af674349150b2b818","name":"Mubarik","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/af8c0b8b43a042ae4d9fd3cb5207b18bbe898d7ab63344df28ac22803b26a0ee?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\/af8c0b8b43a042ae4d9fd3cb5207b18bbe898d7ab63344df28ac22803b26a0ee?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Mubarik"},"url":"https:\/\/webkul.com\/blog\/author\/md-mubarik459\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/370821","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\/354"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=370821"}],"version-history":[{"count":8,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/370821\/revisions"}],"predecessor-version":[{"id":374342,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/370821\/revisions\/374342"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=370821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=370821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=370821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}