QuestionQ32

APIs and Services

An Adobe Commerce developer needs to add custom data to orders retrieved through the API.

While following best practices, how should the developer accomplish this?

Explanation

Extension attributes are the supported mechanism for adding data to Adobe Commerce API data interfaces. An after plugin on Magento\Sales\Api\OrderRepositoryInterface can populate the extension attribute on the order returned by get() and on every order in the search results returned by getList(), ensuring the custom data is included in both API retrieval paths. Adobe’s extension-attribute guidance recommends repository after plugins for get and getList responses.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!