Skip to main content
Update the customer’s date of birth. Returns true on success, false on failure.

Usage

MageSDK.updateCustomerDob('1990-05-15').then(function(success) {
  if (success) {
    alert('Birthday updated!');
  }
});

Parameters

dateOfBirth
string
required
The date of birth in YYYY-MM-DD format.

Response

Returns a booleantrue if the update was successful, false otherwise.

Example: Birthday form

<form id="update-dob-form">
  <div>
    <label>Date of Birth</label>
    <input type="date" name="dob" id="dob">
  </div>
  <input type="submit" value="Update Date of Birth" />
</form>

<script>
  document.addEventListener('DOMContentLoaded', function() {
    var form = document.getElementById('update-dob-form');
    form.addEventListener('submit', function(event) {
      event.preventDefault();
      var dob = document.getElementById('dob').value;
      if (dob) {
        MageSDK.updateCustomerDob(dob).then(function(success) {
          if (success) {
            alert("Updated the customer's birthday");
          }
        });
      }
    });
  });
</script>