QuestionQ26

APIs and Services

An Adobe Commerce developer is asked to provide additional information on a quote. When retrieving several quotes, the extension attributes are returned; however, when retrieving a single quote, they are not returned.

What is one reason the extension attributes are missing?

  • A The developer neglected to add collection="true" to their attribute in etc/extension_attributes.xml file.<attribute code="my_attributes" type="MyVendor\MyModule\Api\Data\MyAttributeInterface[]" collection="true" />
  • B The developer neglected to provide a plugin on Magento\Quote\Api\CartRepositoryInterface::get.
  • C The developer neglected to implement an observer on the collection_load_after event.
Explanation

Magento\Quote\Api\CartRepositoryInterface::getList() retrieves multiple quotes, while CartRepositoryInterface::get($cartId) retrieves one quote. Extension attributes that are populated only through the list retrieval path will not be attached during the single-quote retrieval, so a plugin for CartRepositoryInterface::get is required.

Learn more

Community Discussion

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