Request Mandatory Phone number - xmpie-users/uStore-js GitHub Wiki
Not all uStore user details are mandatory (only firstname, lastname and email address). As a store owner, this can make it difficult to get in touch with a customer if there is something that you need to check with them urgently.
If you apply the following JavaScript to a store, it will force any user browsing the store to enter their phone number before they can do anything else:
It works by checking if their phone number is populated, and if not, will show a popup and redirect a user to update their personal information.
<script type="text/javascript">$(document).ready(function() {
if (xmp.sdk.storeFrontParams.currentUser.phoneNumber == "" &&
window.location.href.toLowerCase().indexOf("personalinformation") == -1) {
$("body").append("<div style='position:absolute; z-index:100; background-color:silver; border:2px solid black;top:20px; left:400px; width:700px;height:300px; padding:20px; font-size:24px'>You must update your phone number before moving forward. Please <a href=\'/uStore/PersonalInformation\''>click here</a> to update your contact details.</div>");
}
});</script>
For information on how to add JavaScript to your store: How to add JavaScript to a storefront.