QuestionQ15

APIs and Services

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

How can the developer extend the existing CartItemPrices GraphQL schema to add a custom base_price field?

Explanation

Adobe Commerce merges GraphQL schema definitions from each module’s etc/schema.graphqls file. Declaring base_price as an additional field on CartItemPrices exposes it in the existing type; the field definition can point to an appropriate resolver when custom value resolution is needed. A DI preference does not extend the GraphQL schema.

Learn more

Community Discussion

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