Created a custom module for products with some filters. return it by Magento\Catalog\Api\Data\ProductInterface. how do I include extension attributes in this?
1 Answer
create the extension_attributes.xml file at below path,
path : app/code/Vendor/Module/etc,
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
<attribute code="[Attribute_code]" type="string"/>
</extension_attributes>
</config>