QuestionQ32
APIs and ServicesAn Adobe Commerce developer needs to add custom data to orders retrieved through the API.
While following best practices, how should the developer accomplish this?
- A Create an extension attribute on Magento\Sales\Api\Data\OrderInterface and an after plugin on Magento\Sales\Model\Order::getExtensionAttributes() to add the custom data.
- B Create an extension attribute on Magento\Sales\Api\Data\OrderInterface and an after plugin on Magento\Sales\Api\OrderRepositoryInterface on get() and getList() to add the custom data.
- C Create a before plugin on Magento\Sales\Model\ResourceModel\Order\Collection::load and alter the query to fetch the additional data. Data will then be automatically added to the items fetched from the API.
Community Discussion