I have two custom field sw_menu_icon_img and sw_menu_icon_hover_img on Category in Magento 2 to store the menu icons.

I tried to override \Magento\Catalog\Model\Category and \Magento\Catalog\Model\Category\Tree prepareCollection() + getTree() to include the custom fields, but Magento in Magento\Webapi\Controller\Rest processApiRequest() line 308 converts the array and remove the elements that don't have getters in `Magento\Catalog\Api\Data\CategoryTreeInterface'.

My search results didn't give me anything. Does anyone know how to append custom attributes to the API result ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.