Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Read and update the logged-in customer’s name and marketing consent.
getProfile
updateProfile
MageSDK.getProfile().then(function(resp) { if (resp.success) { console.log(resp.data.profile.firstName, resp.data.profile.lastName); } });
Show Profile properties
MageSDK.updateProfile({ firstName: 'Jane', lastName: 'Doe', acceptsMarketing: true }).then(function(resp) { if (resp.success) { console.log('Updated:', resp.data.profile); } else { console.log('Error:', resp.error); } });
firstName
lastName
<form id="profile-form"> <input name="firstName" id="firstName" placeholder="First name" /> <input name="lastName" id="lastName" placeholder="Last name" /> <label><input type="checkbox" id="marketing" /> Email me offers</label> <button type="submit">Save</button> </form> <script> var form = document.getElementById('profile-form'); MageSDK.getProfile().then(function(resp) { if (!resp.success) return; document.getElementById('firstName').value = resp.data.profile.firstName; document.getElementById('lastName').value = resp.data.profile.lastName; document.getElementById('marketing').checked = resp.data.profile.acceptsMarketing; }); form.addEventListener('submit', function(event) { event.preventDefault(); MageSDK.updateProfile({ firstName: document.getElementById('firstName').value, lastName: document.getElementById('lastName').value, acceptsMarketing: document.getElementById('marketing').checked }).then(function(resp) { alert(resp.success ? 'Saved' : 'Error: ' + resp.error); }); }); </script>