Have your say in Community Polls: What was/is your greatest motivation to start your own business?

I am getting a "Enter a valid phone number" error from the API

I am getting a "Enter a valid phone number" error from the API

Foil8685
Visitor
1 0 0

I am trying to update a Shopify user using this flutter package. When I update the phone number, I am getting this error

customerUserErrors during customerUpdate: [{__typename: CustomerUserError, code: INVALID, field: [customer, phone], message: Enter a valid phone number}]

This is the phone number format that I am using to update it

+91 9878400227

This is my update function for the flutter code

try {
  ShopifyCustomer shopifyCustomer =
      ShopifyCustomer.instance;
  final phone =
      "${currentUser.countryCode} ${currentUser.phone}";
  log(phone);
  await shopifyCustomer.customerUpdate(
    customerAccessToken: currentUser.shopifyAccessToken,
    firstName: currentUser.name,
    phoneNumber: phone,
    email: currentUser.email,
    password: currentUser.password,
    lastName: currentUser.shopifyUser?.lastName,
    acceptsMarketing: true,
  );
  ShopifyAuth shopifyAuth = ShopifyAuth.instance;
  ShopifyUser? user =
      await shopifyAuth.currentUser(forceRefresh: true);
  currentUser.shopifyUser = user;
} catch (e) {
  log("Error updating shopify user:\n$e");
}

Is there anything that I am doing wrong. Do let me know. 

Best Regards

Replies 0 (0)