Shopify password update using Shopify API
Asked Answered
L

8

12

Can we update password for a User or Customer that already exists in Shopify using the Shopify API?

Laden answered 4/3, 2016 at 10:56 Comment(5)
Doesn't seem like it. Should they not do it themselves?Myrnamyrobalan
Hey @Appleman I don't know they do it or not,but I want to do it myself. And want to know the possibilities. Can you suggest something?Laden
Mmm, I have gone through the API and don't see anything that can help. But I'll keep thinking and let you know as soon as I have a solution.Myrnamyrobalan
thanks keep thinking,as you get solution please let me know :)Laden
Yes, it possible using the customer ( help.shopify.com/api/reference/customer ) API. You will need to use third party API and private apps for the same. Using user email, you will need to find user ID using customers/search.json?query=email:'.$customer_email.' . After getting the id of customer you can update password by passing PUT request with customer id, password and confirm the password. I had implemented it for one of my client. I am 100% sure its possible,Healion
S
4

The User endpoint is available for Shopify Plus stores, but it is currently read only - no user management is possible via this API

https://docs.shopify.com/api/reference/user

Ser answered 9/3, 2016 at 16:36 Comment(0)
C
9

Although the API documentation does not say anything about changing the customer password, you can do actually change the customer password using the PUT /admin/customers/#{id}.json endpoint. Note that my answer is only for customers and not for users.

I have tested it, successfully changed the customer password and log in on the store with the new password. During my tests I used a private app and a normal app both with successful results.

Example:

PUT /admin/customers/5206361102.json

Body:

{
  "customer": {
    "id": 5206361102,
    "password": "mypass2",
    "password_confirmation": "mypass2"
  }
}

If you need the customer id you can use the the GET /admin/customers/search.json end point to find it.

For example you can get the id from the results of this:

GET /admin/customers/search.json?query=email:[email protected]

Result:

{
  "customer": {
    "id": 5206556238,
    ... other parameters ...
  }
}

Thank you to @spviradiya for the comment that pointed me out to this answer, I have tested it and implemented it into my project.

Cyclopropane answered 20/12, 2016 at 2:23 Comment(2)
Great answer! I'd only add "send_email_welcome": false as pointed out by Abhijit, just to avoid spamming them with an unnecessary email.Payload
I'm using /admin/api/2021-10/customers/<ID>.json, but yes, this still works. I'm using Shopify Plus and the admin API.Gook
S
4

The User endpoint is available for Shopify Plus stores, but it is currently read only - no user management is possible via this API

https://docs.shopify.com/api/reference/user

Ser answered 9/3, 2016 at 16:36 Comment(0)
F
3
        PUT /admin/customers/#{id}.json
    {
      "customer": {
        "id": 207119551,
        "password": "newpass",
        "password_confirmation": "newpass",
        "send_email_welcome": false
      }
    }
Frag answered 7/2, 2018 at 10:43 Comment(0)
Q
0

NO, its not possible for now in the normal shopify store API. May this type of feature they expanding in to the next plus version but to be honest Plus is costly so very rare people using it compare to normal shopify store.

Quell answered 19/7, 2016 at 8:51 Comment(1)
I'm always shocked to find anyone who can afford to use Plus at all. They must be making millions in annual sales!Payload
G
0

If You want to update password of your store's customer using shopify Api then yes it is possible. Here is Sample Code:-

$password = array(
          "customer"=>array(
              'id'=>$customerid,
              'password'=> $new_password,
              'password_confirmation'=>$confirm_password    

          )
      );
$customer = $shopify("PUT /admin/customers/$customerid.json" , $password);

You can update shopify store's customer password this way. But if you are talking about user then this API us only available for shopify plus store.check this link:- https://help.shopify.com/api/reference/plus/user

Thanks

Gannet answered 22/5, 2018 at 7:34 Comment(0)
V
0

NO,

Still in 2019 it is not possible it is just read only. Even you can visit this link

Vestavestal answered 7/11, 2019 at 9:16 Comment(0)
A
0

If you want to update the password of your user using the shopify API please try to use the below code:-

$updatePassword = array(
          "customer"=>array(
              'id'=>$userId,
              'password'=> $updatedPassword,
              'password_confirmation'=>$confirm_updatedPassword,
              'send_reset_password_email': true    

          )
      );
$updateCustomer = $shopify("PUT /admin/customers/$userId.json" , $updatePassword);
Avignon answered 15/4, 2022 at 5:42 Comment(0)
D
0

Yes, you can use the Shopify API to change the password for a user or client who is already registered with Shopify. You can use the customerReset mutation to accomplish this. The revised password and the client's email address are required for this modification. An email with a link to reset their username and password is sent to the customer in response to a successful mutation.

mutation customerReset($email: String!, $password: String!) {
customerReset(email: $email, password: $password) {
customer {
  id
  email
    }
   }
 }

Please be aware that only Shopify customers who's accounts were initially set up can have their passwords updated. The customerReset mutation cannot be used to create a fresh client.

Delectable answered 24/5, 2023 at 9:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.