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 1


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"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.