Re: How to update customer state disabled to enabled via API?

Solved

How to update customer state disabled to enabled via API?

eCommExplorer
Tourist
7 0 2

I tried to change the customer state by calling the customer API, with PUT method. It is not working. Seems like getting the customer enabled is possible only by sending account activiation URL. How do i achieve this without  initiating accountactivation URL?

 

Accepted Solution (1)

Luke_K
Shopify Staff
402 66 101

This is an accepted solution.

Hey @eCommExplorer 

Yes, customer state is a read only value in REST(docs) but you should be able to get there by trying this, a HTTP Post to customers.json

 

{
	"customer": {
		"first_name": "Steve",
		"last_name": "Lastnsameson",
		"email": "coolemail@email.com",
		"phone": "+15149146011",
		"verified_email": true,
		"addresses": [
			{
				"address1": "123 Oak St",
				"city": "Ottawa",
				"province": "ON",
				"phone": "555-1212",
				"zip": "123 ABC",
				"last_name": "Lastnameson",
				"first_name": "Mother",
				"country": "CA"
			}
		],
		"password": "newpass",
		"password_confirmation": "newpass",
		"send_email_welcome": false
	}
}

 

This workaround will return a customer with an enabled state. Hope that helps!

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!

View solution in original post

Replies 10 (10)

Luke_K
Shopify Staff
402 66 101

This is an accepted solution.

Hey @eCommExplorer 

Yes, customer state is a read only value in REST(docs) but you should be able to get there by trying this, a HTTP Post to customers.json

 

{
	"customer": {
		"first_name": "Steve",
		"last_name": "Lastnsameson",
		"email": "coolemail@email.com",
		"phone": "+15149146011",
		"verified_email": true,
		"addresses": [
			{
				"address1": "123 Oak St",
				"city": "Ottawa",
				"province": "ON",
				"phone": "555-1212",
				"zip": "123 ABC",
				"last_name": "Lastnameson",
				"first_name": "Mother",
				"country": "CA"
			}
		],
		"password": "newpass",
		"password_confirmation": "newpass",
		"send_email_welcome": false
	}
}

 

This workaround will return a customer with an enabled state. Hope that helps!

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
eCommExplorer
Tourist
7 0 2

Hi, This is to create new user, I want to change existing customer state from "disabled" to "enabled" without sending an activation URL.

If this is not possible, is it possible to send a mobile app deep link as account activation URL? how do I initiate different deep link for andriod and IOS?

yash_agarwal
Shopify Partner
4 0 0

Hi, Did anyone find any solution to this? Possible to do this programatically?

gateley
Visitor
2 0 0

Yes, you just need to send a post request to that specific customer account with the fields password, password_confirmation, send_welcome_email and that will activate the account. 

peter90
Shopify Partner
7 0 0
i just tried, it returned " 406Not Acceptable " is it in the correct format 
{
"password":"As@12345",
"password_confirmation":"As@12345",
"send_welcome_email":true
}
peter90
Shopify Partner
7 0 0

Hi, is there any solution for this?

stephanss
Visitor
1 0 1

Same here, tried but not working any solution?

ShopifyDevSup
Shopify Staff
1453 238 499

Hey @stephanss, you could use the activatebyURL mutation in our Storefront GraphQL API to force a customer state status update. You would still need to capture the activation URL that's generated upon customer creation, but if you push the GraphQL call and include a password for the customer, it would effectively set their status to "active". 

 

It can speed up the process, so that you're able to activate the customer without them having to click through the email activation link themselves. Hope this helps - let us know if we can clarify anything on our end!  

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

icedcapp
Shopify Partner
2 0 0

When using the activatebyURL mutation, can we silence the account confirmation email?

ShopifyDevSup
Shopify Staff
1453 238 499

Hey @icedcapp!

The confirmation email mentioned helps ensure account security using a verification link that is sent, however we did a bit more of digging and found reference where the confirmation email can be disabled via a merchant request to Shopify Support. Looking at previous posts in the forums, there was mention of some configurations that are only be available to Plus stores, so either way we would suggest connecting with support to confirm if it is an option for the store you are working on.

Cheers!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog