SMS Alert provides four shortcodes for WordPress: Signup with Mobile, Login with OTP, Share Cart and OTP Verification. A shortcode is a short tag in square brackets that you paste into a page or post; WordPress replaces it with a form or button. With them you can add mobile-number signup, passwordless login, SMS cart sharing and OTP verification to a page without writing a form or editing theme files.
The four shortcodes at a glance
Shortcode | What it adds | Typical page | Needs |
|---|---|---|---|
Signup with Mobile | A registration form that asks for a mobile number instead of a long form | Register page | Plugin and connected account |
Login with OTP | A login form that sends a one-time password by SMS | Login page | Registered users with a mobile number |
Share Cart | A button that sends the shopper’s cart link by SMS to another person | Cart page | WooCommerce, at least one item in the cart |
OTP Verification | OTP verification for any form, including custom HTML forms | Any page with a form | The CSS selectors of the phone field and submit button |
Shortcode tags
- [sa_signupwithmobile]
- [sa_loginwithotp]
- [sa_sharecart]
- [sa_verify phone_selector=”#phone” submit_selector=”.submit-btn”]
Before you start
- Install and activate the SMS Alert WordPress plugin and connect your SMS Alert account. See the WordPress SMS plugin setup guide.
- Keep SMS credits in your account. Every OTP or cart-link SMS these shortcodes send uses credits.
- For India routes, the OTP message must match an approved DLT template and sender ID.
- For Share Cart, WooCommerce must be active.
How to add any SMS Alert shortcode to a page
- Open the SMS Alert plugin settings and go to the Shortcodes section.
- Click the copy icon next to the shortcode you want.
- Edit the page or post where the form or button should appear.
- Paste the shortcode into a Shortcode block (block editor), the content area (classic editor) or a Shortcode widget (page builder).
- Click Update or Publish.
- Open the page in a private browser window to see it as a visitor. Logged-in users usually do not see login or signup forms.
Signup with Mobile shortcode
Signup with Mobile lets a visitor create an account with only a mobile number, so they do not have to fill in a long registration form.
[sa_signupwithmobile]Paste it on the page where you want the registration form, for example a page titled “Register”. For the full setup options, see Signup With Mobile.
Login with OTP shortcode
Login with OTP lets a user sign in without a password by entering a one-time password sent to their mobile number.
[sa_loginwithotp]How it works:
- The user enters their mobile number.
- The plugin looks for a registered user with that number and sends an OTP by SMS.
- The user enters the OTP.
- After the OTP is verified, the user is logged in.
The number must already belong to a registered user. To enable login with OTP for the WooCommerce login form instead of a separate page, see WooCommerce OTP verification.
Share Cart shortcode
Share Cart adds a button that lets a shopper send their cart to someone else by SMS, for example so a friend or family member can review the items or pay for the order.
[sa_sharecart]How it works:
- The shopper clicks the Share Cart button.
- A form asks for the shopper’s name and number and the recipient’s name and number.
- After the shopper submits it, the recipient receives the cart link by SMS.
The button appears only when the cart has at least one item. To test it, add a product to the cart in your store, then open the page that holds the shortcode. For more options, see Share Cart.
OTP Verification shortcode for any form
The OTP Verification shortcode adds OTP verification to almost any form on your site, whether it was built with a form plugin SMS Alert supports, another plugin, or custom HTML. The visitor must verify their mobile number with an OTP before the form submits.
The shortcode needs two values:
Value | What to enter | Example |
|---|---|---|
Phone field selector | The CSS selector of the form’s mobile number input |
|
Submit button selector | The CSS selector of the form’s submit button |
|
Selectors are the same jQuery-style selectors used in CSS: # selects by id and . selects by class name.
[sa_verify phone_selector="#phone" submit_selector=".submit-btn"]How to find your form’s selectors
- Open the page with your form in a browser.
- Right-click the mobile number field and choose Inspect.
- Find the
idorclassin the highlighted HTML and write it with#for an id or.for a class. - Repeat for the submit button.
- Replace the example values in the shortcode, paste it on the same page as the form, then update the page and test.
Use a selector that matches only that field or button. If two elements share a class, the OTP step may attach to the wrong one.
Troubleshooting
Problem | What to check |
|---|---|
The shortcode text appears on the page instead of a form | Confirm the SMS Alert plugin is active and that the shortcode sits in a Shortcode block or the content area, not inside a code or preformatted block. |
No OTP SMS arrives | Check your SMS credit balance, the mobile number, the sender ID, DLT template approval for India routes and the delivery report in your account. See credits and delivery. |
Login with OTP does not recognise a number | The number must belong to a registered user. Check the number stored in that user’s profile. |
The Share Cart button is missing | The cart is empty. Add at least one item and reload the page. |
OTP Verification does not start on submit | Check that both selectors match the right elements and that the shortcode is on the same page as the form. |
The form looks different in the page builder preview | Test on the live page in a private window. |
Frequently asked questions
What is a shortcode in the SMS Alert WordPress plugin?
A shortcode is a text tag in square brackets that you paste into a page or post. WordPress replaces it with a feature, such as a signup form, login form or button.
How many shortcodes does SMS Alert provide?
Four: Signup with Mobile, Login with OTP, Share Cart and OTP Verification.
Do I need coding skills to use them?
No for Signup with Mobile, Login with OTP and Share Cart: copy, paste and update the page. OTP Verification needs you to find two CSS selectors for your form.
Do the shortcodes work without WooCommerce?
Signup with Mobile, Login with OTP and OTP Verification do not depend on WooCommerce. Share Cart needs a cart, so it needs WooCommerce
Can I verify a form built with another plugin or custom HTML?
Yes. The OTP Verification shortcode works with forms from other plugins and with custom HTML forms, as long as you supply the phone field and submit button selectors.
How do I find a form's CSS selector?
Right-click the field, choose Inspect and read its id or class. Use # before an id and . before a class.
Why is the Share Cart button not showing?
The button appears only when the cart contains at least one item.
Do shortcodes use SMS credits?
Yes. Each OTP and each shared cart link is an SMS sent through your SMS Alert account.
Where do I find the shortcodes?
In the Shortcodes section of the SMS Alert plugin settings
