WordPress · WPForms · OTP

How to add OTP phone verification to WordPress forms

Fake phone numbers waste a sales team's time. How I added SMS OTP verification to WPForms enquiries and phone OTP login to WooCommerce, with custom plugins.

Mohit Goyal 5 min read
How to add OTP phone verification to WordPress forms

To add OTP phone verification to a WordPress form, connect the form to an SMS OTP service, send a one-time code when the visitor enters their number, and only let the form submit once they type the code back. On PropAlert I did this inside WPForms with custom plugins and a little JavaScript, so every enquiry reaches the sales team with a verified phone number. The same approach powers phone OTP login on IPL Biologicals.

Why verify phone numbers on a lead form?

Because a lead you cannot call is not a lead. PropAlert helps home buyers in India track under-construction projects and avoid stalled developments. Its sales team follows up by phone. An enquiry with a mistyped or fake number costs them time and gives nothing back.

Email confirmation does not solve this, because the team does not need an email address. They need a phone that rings. OTP verification proves the visitor has the phone in their hand at the moment they submit.

How does OTP verification on a form work?

Rendering diagram…

The visitor never leaves the page. On PropAlert, JavaScript handles the code step inside the form itself, and the custom plugins talk to the OTP API on the server. Keeping that logic in plugins, separate from the custom theme, means a theme change later does not touch the lead flow.

Should you replace your form plugin to get OTP?

Usually not. PropAlert's team already knew WPForms, so I kept it as the form layer and added the verification around it. They kept building and editing forms the way they always had. The only change they saw was that every enquiry now arrived with a verified number.

ApproachWhen it fitsTrade-off
Add OTP around your current form pluginThe team knows its form tool and the forms workNeeds a small custom plugin
An all-in-one OTP form pluginA new site with no existing formsYour team learns a new form builder
OTP at login instead of on formsShops and member areas where people sign inProtects accounts, not enquiry quality

My general rule on when a custom plugin beats an off-the-shelf one is in when should you build a custom WordPress plugin.

How does phone OTP login work on WooCommerce?

Same idea, different moment. Instead of verifying a number before a form submits, you verify it instead of asking for a password. IPL Biologicals sells biofertilisers and biopesticides, and many of its customers are farmers who browse on mobile. Passwords are friction on a phone, and forgotten passwords are worse. On the retainer I added phone OTP login over SMS for customers and admins, so signing in means entering a number and the code that arrives.

What should every OTP setup include?

  1. 1

    Limit resend requests

    Cap how many codes one number or one visitor can request in a short time, so bots cannot run up your SMS bill.

  2. 2

    Expire codes quickly

    A code should work once and only for a few minutes.

  3. 3

    Validate on the server

    The JavaScript step is for the visitor's convenience. The plugin must check the code on the server before the form saves.

  4. 4

    Handle country codes

    Decide which countries you accept and show the expected format in the field.

  5. 5

    Write a clear fallback

    Tell visitors what to do if the text does not arrive, such as resend after a short wait or call the office.

  6. 6

    Test on real phones

    Different networks and handsets, with autofill of SMS codes on and off.

Spam can still get through other doors

OTP protects the form it is on. On Easy Parenting Hub, junk leads came from a separate button, which I removed before adding spam protection on both domains. Check every route into your inbox, not just the main form.

Which forms are worth the extra step?

Not every form needs a code. OTP adds a few seconds and a small cost per message, so put it where a fake number does real damage.

  • Enquiry forms that lead to a sales call. This is the PropAlert case. Its Enquire Now flow feeds a team that follows up by phone.
  • Forms that start a paid process. PropAlert also has a Pay Now flow. On a payment form, a verified number gives a team a way to reach the buyer if a payment needs following up.
  • Logins on mobile-first shops. On IPL Biologicals, the code replaces the password, so it removes friction rather than adding it.
  • Not newsletter sign-ups or general contact forms. For those, spam protection and a required email field are usually enough, and an extra step costs more sign-ups than it saves.

If you are unsure, start with the one form your sales team complains about most and measure what changes.

What else makes a lead form trustworthy?

Verification is one layer. On PropAlert the long-form pages explain the problem and the product before asking for anything, so the people who reach the form already understand what they are enquiring about. That improves lead quality as much as any code.

Where the leads go matters too. A verified enquiry sitting in a WordPress table helps nobody. On Taxocity every submission lands in a Google Sheet the CRM reads from, which I describe in how to send WordPress form entries to Google Sheets.

How do you get started?

List the forms that feed your sales team and the action each one should lead to. Then decide where verification earns its extra step. I build this kind of lead flow through my custom WordPress plugins service. If fake numbers are getting through your forms, send me the site and I will reply with a plan for verified enquiries.

Frequently asked

Can WPForms verify phone numbers with an OTP?+

Not by itself. WPForms collects the number but does not send codes. On PropAlert I connected WPForms to an OTP API through custom plugins, with JavaScript handling the code step inside the form.

Does OTP verification reduce the number of leads?+

It adds a step, so some visitors will not finish. The leads that do arrive have a verified number. For a business that follows up by phone, an enquiry with a fake number was worth nothing anyway.

Can customers log in to WooCommerce with a phone OTP?+

Yes. On IPL Biologicals I added phone OTP login over SMS for both customers and admins, which suits shoppers who mostly use the site on a phone.

Do I have to change form plugins to add OTP?+

No. On PropAlert the team already knew WPForms, so I added verification around it. Their workflow did not change.

What does an OTP setup cost to run?+

Each code is an SMS, and SMS providers charge per message. Limit how often a code can be requested for one number so bots cannot run up the bill.

Mohit Goyal

Written by Mohit Goyal

Senior Web Developer in Gurugram, India. 100+ fast, SEO-friendly sites shipped in 4+ years with Next.js, React and WordPress, including the procol.ai rebuild. Send me your next project.

Keep reading

Let's build

Have a site that needs to be fast, rank and convert?

Open to Work. Usually replies within a day.