0

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

0

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>

Your Answer

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

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