An Adobe Commerce developer was asked to provide additional information on a quote.
When getting several quotes, the extension attributes are returned, however, when getting a single quote it fails to be returned.
What is one reason the extension attributes are missing?
- The developer neglected to add coiiection="trueM to their attribute in etc/extension_attributes.xmi file. O
ottribute code="my_attributesM type="MyVendor\MyModule\Api\Data\^AttributeInterface[]M collection="true" /> - The developer neglected to provide a plugin On Hagento\Quote\Api\CartRepositoryInterface:
:get. - The developer neglected to implement an observer on the coiiection_ioad_after event.
Answer(s): A
Explanation:
The extension attributes are missing because the collection="true" attribute is not set in the etc/extension_attributes.xmi file. This attribute tells Magento that the extension attributes should be returned when the quote is retrieved.
To fix this issue, the developer needs to add the collection="true" attribute to the my_attributes extension attribute.
<attribute code="my_attributes" type="MyVendor\MyModule\Api\Data\AttributeInterface[]" collection="true" />
Once the collection="true" attribute is set, the extension attributes will be returned when the quote is retrieved.
Reveal Solution Next Question