Ecommerce Shopify WordPress Discussion

Shopify Storefront createCustomer does not set phone number

I am trying to call the Shopify storefront GraphQL to create a customer. The customer is being created successfully. However, it does not set the phone number provided for the mutation. Mutation: const String customerCreateMutation = r''' mutation MyMutation($firstName: String, $lastName: String, $email: String!, $password: String!) { customerCreate(input: {firstName: $firstName, lastName: $lastName, email: $email, password: $password}) { customer{ acceptsMarketing createdAt tags displayName email firstName id lastName phone } customerUserErrors { code field message } } } '''; Graphql: final MutationOptions _options = MutationOptions( document: gql(customerCreateMutation), variables: { 'firstName': "john", 'lastName':"doe", 'email':"john@gmail.com", 'password': "password", 'acceptsMarketing': false, 'phone': "9876543211", /// tried as "+919876543211" too }, ); final QueryResult result = await _graphQLClient!.mutate(_options); When I print the customer in the result, I get as result.data['customerCreate']['customer'], i ma getting the phone as null. {__typename: Customer, acceptsMarketing: false, createdAt: 2023-10-19T12:56:35Z, tags: [], displayName: asdasd asdasd, email: as9@asdasdad.asd, firstName: asdasd, id: ********, lastName: asdasd, phone: null, lastIncompleteCheckout: null} Here, it is sending back the phone as null. I have checked the created customer in the Shopify store also. But it is also blank. How do I set the phone number of the customer? Is there any other way?
Shopify storefront GraphQL API uses E.164 standard. for phone number in customerCreate mutation means you need to add [+] [country code] [number] then it will accept the phone number. try adding +91 +919876543211 I think you missed to pass the phone variable in your mutation definition // OLD missing phone variable mutation MyMutation($firstName: String, $lastName: String, $email: String!, $password: String!) { customerCreate(input: {firstName: $firstName, lastName: $lastName, email: $email, password: $password}) { // ADD phone variable indefinition mutation MyMutation($firstName: String, $lastName: String, $email: String!, $phone: String, $password: String!) { HERE ^ customerCreate(input: {firstName: $firstName, lastName: $lastName, email: $email, phone: $phone, password: $password}) { HERE ^ if any doubts please comment.

December 30, 2023

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.