my custom module
schema.graphql
input CustomerInput {
sample_attribute: String @doc(description: "new attribute")
}
but not adding this attribute in customer mutation
magento 2 graphql
I created a custom attribute in Magento backend for Customers
sample_attribute
I tried this answer Answer
how I can solve this??
Best Answer
I guess that you are trying to return a new attribute (a custom one) via customer GQL query. The below answer is based on that.
Below is the sample code of adding a custom attribute to Customer GraphQl query.
Module NameSpace : Kcc Module Name : CustomerGraphQl
app/code/Kcc/CustomerGraphQl/etc/schema.graphqls
The resolver class
app/code/Kcc/CustomerGraphQl/Model/Resolver/Sample.php
When you run the customer query, it should return the new attribute if requested.