Exam4Training

What is one reason the extension attributes are missing?

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?
A . The developer neglected to add coiiection="trueM to their attribute in etc/extension_attributes.xmi file. O ottribute code="my_attributesM type="MyVendorMyModuleApiData^AttributeInterface[]M collection="true" />
B. The developer neglected to provide a plugin On HagentoQuoteApiCartRepositoryInterface: :get.
C. The developer neglected to implement an observer on the coiiection_ioad_after event.

Answer: 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="MyVendorMyModuleApiDataAttributeInterface[]" collection="true" />

Once the collection="true" attribute is set, the extension attributes will be returned when the quote is retrieved.

Exit mobile version