What is Extension Attribute in Magento2? Why use this.
2 Answers
You can refer this link for understanding extension attributes. https://devdocs.magento.com/guides/v2.0/extension-dev-guide/attributes.html https://store.fooman.co.nz/blog/an-introduction-to-extension-attributes.html
Extension Attributes in Magento2 can add additional data to existing Magento APIs without modifying the original code. Extension Attributes are defined in the module's extension_attributes.xml file. This feature allows developers to extend existing APIs' functionality without needing to modify the original code. This improves the performance of the API, as the extra data is loaded only when requested.
Extension Attributes help add additional data to existing API responses, such as customer information, product options, or order information. This allows developers to add additional data to the API responses without modifying the original code. Extension Attributes are also helpful in creating custom API calls, such as adding custom API endpoints to the Magento API.