The SMS Alert WordPress plugin can verify a customer’s mobile number with a one-time password (OTP) sent by SMS in four places in WooCommerce: at checkout (including cash on delivery), as a second step at login (two-factor authentication), as a password-free login, and at account registration. All four are switched on in the plugin’s OTP Settings, and all use one OTP template whose length, validity and retries you can change.
New to the plugin? Install it and connect your account with the WordPress SMS plugin setup guide.
Which OTP feature do you need?
| I want to… | Setting to enable | Section |
|---|---|---|
| Verify the mobile number before an order is placed | Enable OTP for Checkout | Checkout and COD OTP verification |
| Verify only cash on delivery orders | Enable OTP only for Selected Payment Options | Checkout and COD OTP verification |
| Verify only guest shoppers | Verify only Guest Checkout | Checkout and COD OTP verification |
| Ask for an OTP after the password at login | Enable OTP for Login | Two-factor authentication |
| Let customers log in with an OTP instead of a password | Enable OTP for Login and Login with OTP | Login with OTP |
| Verify new accounts | Enable OTP for Registration | OTP verification on signup |
| Stop one number creating several accounts | Disable Allow multiple accounts with same mobile number | OTP verification on signup |
To verify an order after it has been placed instead, see OTP verification after checkout. For password resets, see OTP for reset password.
Before you start
- Install and activate the plugin and connect your SMS Alert account.
- Keep SMS credits in your account. Every OTP, including each resend, is an SMS that uses credits.
- On India routes, your OTP message must match an approved DLT template, and the template must contain the OTP variable. See Convert into DLT Template.
- All OTP settings are in one place: the SMS Alert menu under WooCommerce, then OTP Settings.
Checkout and COD OTP verification
Checkout OTP verification asks the customer to verify their mobile number with an OTP before the order is placed.
- Open the SMS Alert menu under WooCommerce.
- Go to OTP Settings.
- Enable OTP for Checkout.
- Scroll down and edit the OTP template if needed. Keep the
[otp]tag in the message. - Click Save Changes.
Verify only cash on delivery orders. Enable Enable OTP only for Selected Payment Options, then select the payment methods that should require an OTP, such as COD. Orders paid by other methods skip the OTP step.
Verify only guest checkout. Enable Verify only Guest Checkout to require an OTP only from shoppers who are not logged in.
To test, place an order with a selected payment method as a guest and confirm the OTP arrives and the order completes after you enter it.

Two-factor authentication (2FA) with OTP
With two-factor authentication, a user who logs in with a password must also enter an OTP sent to their mobile number.
- Open the SMS Alert menu under WooCommerce.
- Go to OTP Settings.
- Enable OTP for Login.
- Scroll down and edit the OTP template if needed. Keep the
[otp]tag. - Click Save Changes.
Exclude some roles. Enable Exclude Role from LOGIN OTP and select the user roles that should skip the OTP, for example administrators.

Login with OTP
Login with OTP lets a customer sign in with a mobile number and an OTP instead of a password.
- Open the SMS Alert menu under WooCommerce.
- Go to OTP Settings.
- Enable OTP for Login and Login with OTP.
- Scroll down and edit the OTP template if needed. Keep the
[otp]tag. - Click Save Changes.
| Two-factor authentication | Login with OTP |
|---|---|---|
Settings | OTP for Login | OTP for Login and Login with OTP |
What the user enters | Password, then OTP | Mobile number, then OTP |
Purpose | Adds a second check to password login | Replaces the password |
You can also place a Login with OTP form on any page with the Login with OTP shortcode.

OTP verification on signup
Signup verification asks new customers to verify their mobile number with an OTP when they register.
- Open the SMS Alert menu under WooCommerce.
- Go to OTP Settings.
- Enable OTP for Registration.
- Scroll down and edit the OTP template if needed. Keep the
[otp]tag. - Click Save.
Block duplicate accounts. To stop several accounts using one mobile number, disable Allow multiple accounts with same mobile number. OTP for Registration must also be enabled.
To let people register with only a mobile number on a separate page, see the Signup With Mobile page.

OTP template settings: length, validity and retries
These settings apply to the OTP message used by every feature above. You can change them by adding attributes to the [otp] tag in the OTP template. Do not remove the tag itself, because the plugin replaces it with the code.
Setting | Default | Allowed values | How to change it |
|---|---|---|---|
OTP length | 4 digits | 3 to 8 digits |
|
OTP validity | 15 minutes | Any number of minutes |
|
Resend limit | 5 resends during the validity period | Any number |
|
Example template with a 6-digit code:
Your OTP is [otp length="6"]. Do not share it with anyone.Several attributes can be combined in one tag, for example [otp length="6" validity="10" retry="3"]
On India routes, the template text must still match your approved DLT template. A longer OTP or a different sentence needs a template approved with that wording.
Redirect users after login or signup
WooCommerce provides filters that decide where a user lands after logging in or registering. Add the code to a child theme’s functions.php or to a code snippets plugin. Edits to a parent theme’s functions.php are lost when the theme updates.
After login
add_filter( 'woocommerce_login_redirect', 'sa_login_redirect' );
function sa_login_redirect( $redirect_to ) {
return home_url( '/my-account/' ); // replace with your page
}After registration
add_filter( 'woocommerce_registration_redirect', 'sa_register_redirect' );
function sa_register_redirect( $redirect ) {
return home_url( '/welcome/' ); // replace with your page
}Both filters return the URL. [Test both snippets on a staging site before publishing. The previous version of this page used wp_redirect() and exit() inside the registration filter, which can interrupt other redirects.]
Troubleshooting
Problem | What to check |
|---|---|
No OTP arrives | Check your SMS credit balance, the mobile number format, the sender ID, DLT template approval on India routes and the delivery report in your SMS Alert account. |
OTP message is rejected on India routes | The template text probably differs from your approved DLT template, or the OTP variable is missing from it. Compare them. |
The OTP field does not appear at checkout | Confirm OTP for Checkout is enabled and saved. If you selected specific payment options, confirm the customer chose one of them. |
COD customers are not asked for an OTP | Check that COD is selected under Enable OTP only for Selected Payment Options. |
Logged-in customers skip OTP at checkout | Verify only Guest Checkout may be enabled. |
An administrator cannot log in without an OTP | Use Exclude Role from LOGIN OTP for that role, or log in from a number you control. |
“OTP expired” appears | The code is valid for 15 minutes by default, or the value you set with |
The user cannot request another OTP | The resend limit (5 by default, or your |
Someone registers with a number already in use | Disable Allow multiple accounts with same mobile number and make sure OTP for Registration is on. |
Redirect after login does not work | Confirm the snippet is active, the filter name is correct and another plugin is not overriding the redirect. |
Frequently asked questions
Can I enable OTP verification only for COD?
Yes. In OTP Settings, enable Enable OTP only for Selected Payment Options and select cash on delivery.
Can I verify only guest checkout?
Yes. Enable Verify only Guest Checkout.
What is the difference between 2FA and Login with OTP?
Two-factor authentication adds an OTP step to login (enable OTP for Login). Login with OTP lets the user sign in with an OTP instead of a password (enable OTP for Login and Login with OTP).
Can I exclude some user roles from login OTP?
Yes. Enable Exclude Role from LOGIN OTP and select the roles.
Can I stop multiple accounts using the same mobile number?
Yes. Disable Allow multiple accounts with same mobile number and keep OTP for Registration enabled.
How do I change the OTP length?
Replace [otp] in the template with [otp length="6"]. The default is 4 digits and the range is 3 to 8.
How long is an OTP valid?
15 minutes by default. Change it with [otp validity="6"].
Can I limit OTP retries?
Yes. By default an OTP can be resent 5 times during its validity period. Change that with [otp retry="2"].
Do I have to keep the [otp] tag in the template?
Yes. The plugin replaces the tag with the code, so a template without it sends no OTP.
How do I redirect users after login or registration?
Use the WooCommerce filters woocommerce_login_redirect and woocommerce_registration_redirect. See the code above.
Does every OTP use SMS credits?
Yes, including resends.
Can I verify an order after it is placed instead?
Yes. See OTP verification after checkout.
