ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 45 - AD0-E716 discussion

Report
Export

An Adobe Commerce developer is creating a new module to extend the functionality of the cart. The module is installed in app/code/CompanyName/ModuleName/.

How would an Adobe Commerce developer extend the existing CartltemPrices GraphQL schema to include a custom base_price field?

A.
Create and Configure a for Hagento\QuoteGraphQl\Model\Resolver\CartItemPrices that adds the base_price field in the resolve() function.
Answers
A.
Create and Configure a for Hagento\QuoteGraphQl\Model\Resolver\CartItemPrices that adds the base_price field in the resolve() function.
B.
Add the following to the module's etc/schema.graphqis file:
Answers
B.
Add the following to the module's etc/schema.graphqis file:
C.
Add the following to the module's etc/graphqi/di.xmi file:
Answers
C.
Add the following to the module's etc/graphqi/di.xmi file:
Suggested answer: B

Explanation:

The developer can extend the existing CartltemPrices GraphQL schema to include a custom base_price field by adding the following code to the module's etc/schema.graphqls file:

extend type CartltemPrices { base_price: Money! @doc(description: ''The base price of the cart item'') }

This code adds a new field called base_price to the CartltemPrices type and specifies that it is of type Money and it is not nullable. The @doc directive adds a description for the field that will be shown in the schema documentation. The developer also needs to create a custom resolver class for the base_price field and declare it in the di.xml file of the module. Verified

Reference: [Magento 2.4 DevDocs] [Magento Stack Exchange]

asked 02/10/2024
Juan Yontz
46 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first