Dear @kamilski81 ,
yes. it can be updated using following API.
https://shopify.dev/docs/admin-api/rest/reference/customers/customer?api[version]=2020-04#update-2020-04
Procedure as follows.
Goto your Shopify store Admin.
There is a “Apps” option at left side(https://famzon-development.myshopify.com/admin/apps)
Click on “Apps” and it will open the respective things at right side.
In right side find “Manage private apps” Hyper link.
On click of that, will open “Private apps” screen in which you can find “Create new private app” button.
Now click on “Create new private app” button and create the new private APP and get API key and password.
And below of “API key” and “Password” field, you can find “ADMIN API PERMISSIONS” heading.
provide “read and Write” permission for “Customers”. and save that App.
Now copy that “Example URL” provided below that Password field. And append Email update API as follows.( In API_KEY and PASSWORD, replace with your private app’s credentials)
https://{API_KEY}:{PASSWORD}@famzon-development.myshopify.com/admin/api/2020-04/customers/“+{{customer.id}}+”.json
Now using this API, make your AJAX call as follows to update email ID or any other customer information like first name, last name, password etc..
var customerdata = {
"customer": {
"id": {{customer.id}} ,
"first_name": address_first_name,
"last_name": address_last_name,
"email": email,
"password": password,
"password_confirmation": cust_pswd_confirmation
}
};
In above JSON data, “id”: {{customer.id}} is mandatory. Because, the information you are updating based on each user(Customer). So inputting customer ID is mandatory.
jQuery.ajax({
url: "https://API_KEY:PASSWORD@famzon-dev-msc.myshopify.com/admin/api/2020-04/customers/"+{{customer.id}}+".json",
type: "PUT",
data: customerdata,
dataType: "json",
beforeSend: function(x) {
if (x && x.overrideMimeType) {
x.overrideMimeType("application/j-son;charset=UTF-8");
}
},
success: function(result) {
window.location.href = "/account/logout";
}
});
If this AJAX call return success result, then your customer info could have been updated successfully.
Regards,
Pon.