- So for this navigate to Apps in your Shopify admin, and then click on SMS Alert.
- Here click on OTP settings and then enable OTP for login.
- Change the SMS text as required, and ensure you have this OTP tag in your sms text.
- Finally click on save changes.
- Now navigate to Online Store in your Shopify admin and click on Customize button in your current theme.
- Now click on App embeds and enable SMS Alert Login With OTP option and click on Save button on top right of that page.
- After that select your page where you want to add Login With OTP.
- You can add Login With OTP by clicking on Add Section or Add Block.
- After adding it, click on Save button.
How to add Login With OTP option at fixed position?
- So for this navigate to Online Store in your Shopify admin and go to edit code in your current theme.
- If apps.liquid file not exists in your theme section then create it and add this code
{% schema %}
{
"name": "App wrapper",
"settings": [],
"blocks": [
{
"type": "@app"
}
],
"presets": [
{
"name": "App wrapper"
}
]
}
{% endschema %}
- Go to section of your page where you want to add Login With OTP
- Add below code to that position where you want to show Login With OTP
{% for block in section.blocks %}
{% render block %}
{% endfor %}
- Then repeat previous step to add Login With OTP button.
Lets see how this works in different scenarios.
1.Mobile number is not registered.
Lets try with a number that is not registered on the website, and when he tries to login, this will show an error that the mobile number is not registered.
2.User has an old account on the website.
When any old user tries to login to the website, and if it is not linked to sms alert, the user is asked to enter the last password he remember, after OTP verification
This process will forcefully change the user accounts password to this, so in case the user does not remember the old password, he can put a new password here. And soon after this, he is logged in his account.
3.Uer has an account, and is linked to SMS Alert
The user enters his mobile number, he is prompted to enter the OTP, and upon successful verification, he is logged in to his account.
Can we add Login With OTP button to our page?
Yes, you can add, by including smsalert loginwithotpbutton section.
{% section ‘loginwithotpbutton’ %}