Im trying to create customers using the GraphQL API.
I have the below code, but somehow the response object is a customer with all properties being null values. The customer is created in Shopify though, so that works. Maybe im making some mistake?
public async Task<Customer> CreateCustomerFromInputModelAsync(Register.InputModel inputModel)
{
GraphRequest request = new()
{
query = $@"
mutation customerCreate($input: CustomerInput!) {{
customerCreate(input: $input) {{
customer {{
id
email
firstName
lastName
phone
metafields(first: 10) {{
edges {{
node {{
id
key
value
}}
}}
}}
}}
userErrors {{
field
message
}}
}}
}}
",
variables = new
{
input = new
{
email = inputModel.Email,
firstName = "testname",
}
}
};
var service = _graphServiceFactory.Create(_credentials.Shop_Domain, _credentials.Shop_AccessToken);
var response = await service.SendAsync<Customer>(request);
return response;
}
Im trying to create customers using the GraphQL API.
I have the below code, but somehow the response object is a customer with all properties being null values. The customer is created in Shopify though, so that works. Maybe im making some mistake?