{"id":56486,"date":"2016-08-05T16:09:26","date_gmt":"2016-08-05T16:09:26","guid":{"rendered":"http:\/\/webkul.com\/blog\/?p=56486"},"modified":"2026-02-05T14:29:02","modified_gmt":"2026-02-05T14:29:02","slug":"add-extension-attribute-magento2","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/","title":{"rendered":"How to add extension attribute in Magento 2"},"content":{"rendered":"\n<p>Magento 2 provides <strong>extension attribute<\/strong> to extend core API data interfaces safely.<br>They allow developers to add custom data <strong>without modifying core Magento code<\/strong>.<\/p>\n\n\n\n<p>This approach keeps your store <strong>upgrade-safe and API-friendly<\/strong>.<\/p>\n\n\n\n<p>Also have you check our <a href=\"https:\/\/store.webkul.com\/magento2-order-attributes.html\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 Order attributes<\/a>\u00a0extension?<\/p>\n\n\n<div class=\"wk-index-wrap\">\n<h3 class=\"index-title\">What Are Extension Attributes in Magento 2?<\/h3>\n<\/div>\n<p>Extension attributes allow you to add extra fields to Magento service contracts.<br data-start=\"900\" data-end=\"903\" \/>They attach additional data to existing API data interfaces.<\/p>\n<p>Magento exposes these attributes automatically in <strong data-start=\"1015\" data-end=\"1037\">REST and SOAP APIs<\/strong>.<br data-start=\"1038\" data-end=\"1041\" \/>This makes them ideal for integrations and frontend customizations.<\/p>\n\n<div class=\"wk-index-wrap\">\n<h3 class=\"index-title\">Why Magento Introduced Extension Attributes<\/h3>\n<\/div>\n<p>Magento restricts direct modification of data interfaces.<br data-start=\"1220\" data-end=\"1223\" \/>This ensures backward compatibility and stable APIs.<\/p>\n<p>Extension attributes solve this limitation by allowing structured extension.<br data-start=\"1353\" data-end=\"1356\" \/>They support both simple and complex data types.<\/p>\n\n<div class=\"wk-index-wrap\">\n<h3 class=\"index-title\">Extension Attributes vs Custom Attributes<\/h3>\n<\/div>\n<p>Custom attributes store simple values like text or numbers.<br data-start=\"1516\" data-end=\"1519\" \/>They usually map directly to database columns.<\/p>\n<p>Extension attributes support <strong data-start=\"1596\" data-end=\"1639\">objects, arrays, and complex structures<\/strong>.<br data-start=\"1640\" data-end=\"1643\" \/>They work best for API-level data enhancements.<\/p>\n\n<div class=\"wk-index-wrap\">\n<h3 class=\"index-title\">When Should You Use Extension Attributes?<\/h3>\n<\/div>\n<p>Use extension attributes when:<\/p>\n<ul>\n<li>You need to extend API responses<\/li>\n<li>You want to pass extra data during checkout<\/li>\n<li>You want structured or grouped data<\/li>\n<li>You must avoid modifying core tables<\/li>\n<\/ul>\n\n<div class=\"wk-index-wrap\">\n<h3 class=\"index-title\">Practical Scenario: Add Custom Delivery Instructions at Checkout<\/h3>\n<\/div>\n<p>Assume you want to add <strong data-start=\"2037\" data-end=\"2062\">Delivery Instructions<\/strong> during checkout.<br data-start=\"2079\" data-end=\"2082\" \/>You want this data available in APIs and order processing.<\/p>\n<p>The default checkout does not support this field.<br data-start=\"2191\" data-end=\"2194\" \/>Extension attributes provide the correct solution.<\/p>\n<div class=\"wk-index-wrap\">\n<h3 class=\"index-title\">Step 1: Identify the Target Interface<\/h3>\n<\/div>\n<p>Magento checkout uses <code data-start=\"2315\" data-end=\"2345\">ShippingInformationInterface<\/code>.<br data-start=\"2346\" data-end=\"2349\" \/>This interface transfers shipping data during checkout.<\/p>\n<p>We will extend this interface with a custom field.<br data-start=\"2456\" data-end=\"2459\" \/>The field will store delivery instructions.<\/p>\n<div class=\"wk-index-wrap\">\n<h3 class=\"index-title\">Step 2: Create extension_attributes.xml<\/h3>\n<\/div>\n<p>Create the file at:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">app\/code\/Vendor\/Module\/etc\/extension_attributes.xml<\/pre>\n<p>This file declares new extension attributes for interfaces.<\/p>\n<h4>Example: Adding a Scalar Extension Attribute<\/h4>\n<p>Scalar attributes store simple values like strings.<br data-start=\"2804\" data-end=\"2807\" \/>Delivery instructions fit this category.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;?xml version=\"1.0\"?&gt;\n&lt;config xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n xsi:noNamespaceSchemaLocation=\"urn:magento:framework:Api\/etc\/extension_attributes.xsd\"&gt;\n    &lt;extension_attributes for=\"Magento\\Checkout\\Api\\Data\\ShippingInformationInterface\"&gt;\n        &lt;attribute code=\"delivery_instructions\" type=\"string\"\/&gt;\n    &lt;\/extension_attributes&gt;\n&lt;\/config&gt;<\/pre>\n<p>Magento now recognizes this field at the API level.<\/p>\n<div class=\"wk-index-wrap\">\n<h3 class=\"index-title\">Step 3: How Magento Generates Getters and Setters<\/h3>\n<\/div>\n<p>Magento automatically generates methods for extension attributes.<br data-start=\"3401\" data-end=\"3404\" \/>You do not manually create getters or setters.<\/p>\n<p>Magento creates these methods during compilation:<\/p>\n<ul>\n<li><em>getDeliveryInstructions()<\/em><\/li>\n<li><em>setDeliveryInstructions($value)<\/em><\/li>\n<\/ul>\n<div class=\"wk-index-wrap\">\n<h3 class=\"index-title\">Step 4: Read Extension Attribute<\/h3>\n<\/div>\n<p>Magento provides access via extension attributes object.<br data-start=\"4237\" data-end=\"4240\" \/>You should never access it directly from request data.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">public function beforeSaveAddressInformation(\n    \\Magento\\Checkout\\Api\\ShippingInformationManagementInterface $subject,\n    $cartId,\n    \\Magento\\Checkout\\Api\\Data\\ShippingInformationInterface $addressInformation\n) {\n\n    $extAttributes = $addressInformation-&gt;getExtensionAttributes();\n\n    if ($extAttributes &amp;&amp; method_exists($extAttributes, 'getDeliveryInstructions')) {\n        $deliveryInstructions = $extAttributes-&gt;getDeliveryInstructions();\n        \/\/ Your custom code here\n    }\n\n    return [$cartId, $addressInformation];\n}<\/pre>\n<p>This ensures compatibility with Magento APIs.<\/p>\n<div class=\"wk-index-wrap\">\n<h3 class=\"index-title\">Step 5: Persist Data to Database<\/h3>\n<\/div>\n<p>You can store extension attribute data in:<\/p>\n<ul>\n<li>Quote table<\/li>\n<li>Order table<\/li>\n<li>Custom database table<\/li>\n<\/ul>\n<p data-start=\"5838\" data-end=\"5896\">Use repositories or resource models for clean persistence.<\/p>\n<div class=\"wk-index-wrap\">\n<h3 class=\"index-title\">Step 6: Non-Scalar Extension Attribute Example<\/h3>\n<\/div>\n<p>Sometimes you need complex data like multiple delivery options.<br data-start=\"6232\" data-end=\"6235\" \/>Scalar types are not enough in this case.<\/p>\n<p>Magento supports object and array-based extension attributes.<\/p>\n<h4>XML for Non-Scalar Attribute<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;attribute code=\"delivery_slots\" type=\"Vendor\\Module\\Api\\Data\\DeliverySlotInterface[]\"\/&gt;<\/pre>\n<p>This allows multiple structured values.<\/p>\n<div class=\"wk-index-wrap\">\n<h3 class=\"index-title\">Step 7: Create Custom Data Interface<\/h3>\n<\/div>\n<p>Create the interface:<\/p>\n<p><em>Vendor\/Module\/Api\/Data\/DeliverySlotInterface.php<\/em><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">namespace Vendor\\Module\\Api\\Data;\n\ninterface DeliverySlotInterface\n{\n    const DATE = 'date';\n    const TIME = 'time';\n    \n    \/**\n     * Get Name\n     *\n     * @return string|null\n     *\/\n    public function getDate();\n    \n    \/**\n     * Get Name\n     *\n     * @return string|null\n     *\/\n    public function getTime();\n\n    \/**\n     * Set Date\n     *\n     * @param string $date\n     * @return $this\n     *\/\n    public function setDate($date);\n    \n    \/**\n     * Set Time\n     *\n     * @param string $time\n     * @return $this\n     *\/\n    public function setTime($time);\n}<\/pre>\n<p>Now create it implementation model:<\/p>\n<p><em>Vendor\/Module<\/em>\/Model\/<em>DeliverySlot<\/em>.php<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;?php\nnamespace Vendor\\Module\\Model;\n\nuse Vendor\\Module\\Api\\Data\\DeliverySlotInterface;\nuse Magento\\Framework\\DataObject;\n\nclass DeliverySlot extends DataObject implements DeliverySlotInterface\n{\n    public function getDate()\n    {\n        return $this-&gt;_getData('date');\n    }\n\n    public function setDate($date)\n    {\n        return $this-&gt;setData('date', $date);\n    }\n\n    public function getTime()\n    {\n        return $this-&gt;_getData('time');\n    }\n\n    public function setTime($time)\n    {\n        return $this-&gt;setData('time', $time);\n    }\n}<\/pre>\n<p>Magento now understands the object structure.<\/p>\n\n<div class=\"wk-index-wrap\">\n<h3 class=\"index-title\">Conclusion<\/h3>\n<\/div>\n<p>Extension attributes provide a clean way to extend Magento 2.<br data-start=\"7873\" data-end=\"7876\" \/>They protect core code and support complex integrations.<\/p>\n<p>They are essential for advanced checkout customization.<br data-start=\"7989\" data-end=\"7992\" \/>Every Magento developer should master them.<\/p>\n\n\n<p>However, in case of any query or questions regarding the <a href=\"https:\/\/store.webkul.com\/Magento-2.html\">Magento 2 Extensions<\/a>, you can create a ticket at <a href=\"https:\/\/webkul.uvdesk.com\/\">webkul.uvdesk.com<\/a>\u00a0<\/p>\n\n\n\n<p>or contact us at <a href=\"https:\/\/store.webkul.com\/contacts\/\">store.webkul.com\/contacts\/<\/a>\u00a0to let us know your views to make the plugin better.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Magento 2 provides extension attribute to extend core API data interfaces safely.They allow developers to add custom data without modifying core Magento code. This approach keeps your store upgrade-safe and API-friendly. Also have you check our Magento 2 Order attributes\u00a0extension? What Are Extension Attributes in Magento 2? Extension attributes allow you to add extra fields <a href=\"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":69,"featured_media":54828,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[302],"tags":[3484,2070,590],"class_list":["post-56486","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-magento2","tag-extension-attribute-magento2","tag-magento2","tag-webkul"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to add Extension Attribute Magento2<\/title>\n<meta name=\"description\" content=\"Here we learn, how to add Extension Attribute Magento2. Extension attributes used to extend interface functionality.\" \/>\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-extension-attribute-magento2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to add Extension Attribute Magento2\" \/>\n<meta property=\"og:description\" content=\"Here we learn, how to add Extension Attribute Magento2. Extension attributes used to extend interface functionality.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/\" \/>\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-08-05T16:09:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-05T14:29:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/07\/Magneto-Code-Snippet.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=\"Mahesh 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=\"Mahesh Singh\" \/>\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-extension-attribute-magento2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/\"},\"author\":{\"name\":\"Mahesh Singh\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/53d3b977a0ab5adcf32aef9f97e595bd\"},\"headline\":\"How to add extension attribute in Magento 2\",\"datePublished\":\"2016-08-05T16:09:26+00:00\",\"dateModified\":\"2026-02-05T14:29:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/\"},\"wordCount\":539,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/07\/Magneto-Code-Snippet.png\",\"keywords\":[\"extension attribute magento2\",\"Magento2\",\"webkul\"],\"articleSection\":[\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/\",\"url\":\"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/\",\"name\":\"How to add Extension Attribute Magento2\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/07\/Magneto-Code-Snippet.png\",\"datePublished\":\"2016-08-05T16:09:26+00:00\",\"dateModified\":\"2026-02-05T14:29:02+00:00\",\"description\":\"Here we learn, how to add Extension Attribute Magento2. Extension attributes used to extend interface functionality.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/07\/Magneto-Code-Snippet.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/07\/Magneto-Code-Snippet.png\",\"width\":825,\"height\":260},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to add extension attribute in Magento 2\"}]},{\"@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\/53d3b977a0ab5adcf32aef9f97e595bd\",\"name\":\"Mahesh Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f4c013ebf7008223382b8a49203e6d354677e8baff0eca373e6e4266efa762da?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\/f4c013ebf7008223382b8a49203e6d354677e8baff0eca373e6e4266efa762da?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Mahesh Singh\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/mahesh721\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to add Extension Attribute Magento2","description":"Here we learn, how to add Extension Attribute Magento2. Extension attributes used to extend interface functionality.","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-extension-attribute-magento2\/","og_locale":"en_US","og_type":"article","og_title":"How to add Extension Attribute Magento2","og_description":"Here we learn, how to add Extension Attribute Magento2. Extension attributes used to extend interface functionality.","og_url":"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2016-08-05T16:09:26+00:00","article_modified_time":"2026-02-05T14:29:02+00:00","og_image":[{"width":825,"height":260,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/07\/Magneto-Code-Snippet.png","type":"image\/png"}],"author":"Mahesh Singh","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Mahesh Singh","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/"},"author":{"name":"Mahesh Singh","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/53d3b977a0ab5adcf32aef9f97e595bd"},"headline":"How to add extension attribute in Magento 2","datePublished":"2016-08-05T16:09:26+00:00","dateModified":"2026-02-05T14:29:02+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/"},"wordCount":539,"commentCount":4,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/07\/Magneto-Code-Snippet.png","keywords":["extension attribute magento2","Magento2","webkul"],"articleSection":["Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/","url":"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/","name":"How to add Extension Attribute Magento2","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/07\/Magneto-Code-Snippet.png","datePublished":"2016-08-05T16:09:26+00:00","dateModified":"2026-02-05T14:29:02+00:00","description":"Here we learn, how to add Extension Attribute Magento2. Extension attributes used to extend interface functionality.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/07\/Magneto-Code-Snippet.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/07\/Magneto-Code-Snippet.png","width":825,"height":260},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/add-extension-attribute-magento2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to add extension attribute in Magento 2"}]},{"@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\/53d3b977a0ab5adcf32aef9f97e595bd","name":"Mahesh Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f4c013ebf7008223382b8a49203e6d354677e8baff0eca373e6e4266efa762da?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\/f4c013ebf7008223382b8a49203e6d354677e8baff0eca373e6e4266efa762da?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Mahesh Singh"},"url":"https:\/\/webkul.com\/blog\/author\/mahesh721\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/56486","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\/69"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=56486"}],"version-history":[{"count":13,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/56486\/revisions"}],"predecessor-version":[{"id":525096,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/56486\/revisions\/525096"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media\/54828"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=56486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=56486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=56486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}