Magento 2 Phone Validation by Country and Format
SKU: CUSTOMERPHONEVALIDATION1
- check format and prefix per shipping country
- unify entries and store them in international format
- clear error message at the field, editable per store view
- applies to checkout, registration, address book and admin orders
Einmaliger Kauf · inkl. 12 Monate Updates · zzgl. MwSt.
Magento 2 Phone Validation: clean numbers at the moment of entry
Mironsoft Phone Number Validation brings Magento 2 phone validation to your checkout, registration form and address book. The module checks length, country code and format per country, converts the entry into one consistent format and shows a clear message right at the field when something is wrong. Nothing is saved until the number makes sense. Magento 2 phone validation runs on Alpine.js in the Hyvä theme without any extra library, and you set the rules per store view in the admin.
Format per country
Every shipping country has its own lengths and prefixes; the module checks each number against the rules of the selected country.
Normalisation
Spaces, brackets, hyphens and leading zeros are removed and the number is stored in one international format.
Message at the field
Errors appear directly below the input, in the language of the store view and without reloading the page.
Checkout and account
The same check applies at checkout, in customer registration, in the address book and for orders created in the admin.
Required or optional
Decide per store view whether the phone field is mandatory and whether an empty entry is still allowed.
Admin report
A list shows how many numbers were corrected or rejected, which helps you fine-tune the rules.
Why Magento 2 phone validation pays off
A courier calls, nobody picks up, the parcel goes back. Very often the number has a typo, a missing prefix or letters in it. By default Magento only checks that the phone field is filled in, not whether the content is a usable number. Merchants therefore search for Magento 2 phone validation, Magento 2 phone number format or Magento 2 phone field required.
With Magento 2 phone validation you catch these mistakes while the customer is still looking at the form. That saves support questions, prevents failed deliveries and leaves your team with numbers they can actually call.
Magento 2 phone validation with rules for every shipping country
The check follows the country of the address. Germany, Austria and Switzerland use different lengths than France or Poland, and area codes are written in different ways. If the customer changes the country, the field is checked again. For countries without a stored rule you can choose a looser check or let the entry pass. You can also decide whether mobile and landline numbers are both allowed.
- Length and prefix per country, rules editable in the admin
- Fresh check when the country in the form changes
- Countries without a rule: loose check or pass-through
Unify the phone number and store it in E.164 format
Customers type 0171 1234567, +49 171 1234567 or (0171) 123 45 67. The module converts every variant into one notation, optionally the international format with a plus sign and country code. The display in the account stays readable while the cleaned number is stored. That helps your shipping software hand numbers over to carriers without anybody correcting them by hand.
- Removes spaces, brackets and hyphens
- Replaces a leading zero with the country code
- Storage format selectable: international or national
Error messages customers actually understand
Instead of a generic error, Magento 2 phone validation says what is wrong: number too short, letters included, prefix does not match the selected country. You maintain the texts per store view in the admin. The message appears when the customer leaves the field and again on submit. On a smartphone the numeric keypad opens, and the order button stays disabled until the entry is correct.
- Own texts per store view and language
- Check on blur and on submit
- Numeric keypad on smartphones
Where the check runs and what the admin sees
You decide in which areas the validation runs: checkout, registration, address book, admin orders. Existing customer numbers stay untouched; a console command, if you wish, cleans the existing data in one pass. The admin report shows rejected and converted entries per country so you can see where the rules are too strict or too loose.
- Each area can be switched on or off
- Console command to clean existing data
- Report of rejected entries per country
Where Magento 2 phone validation helps in daily shop work
Situations where Magento 2 phone validation saves money and nerves.
Parcel delivery
Drivers and freight carriers need a number they can reach. Checked and uniform numbers reduce failed deliveries and follow-up calls.
Scheduled delivery and assembly
Anyone offering delivery windows or assembly calls the customer first. A wrong number makes the appointment worthless.
International shops
When you ship to several countries, the right rule applies per country and you do not maintain scripts of your own.
Cleaning old customer data
The console command unifies existing numbers before you use them for SMS notifications or shipping software.
Magento 2 phone validation: without and with the module
The difference to the default phone field.
| Topic | Without the module | With Mironsoft Phone Number Validation |
|---|---|---|
| Check | Required field only, any string is accepted | Length and prefix checked per country |
| Notation | Mixed, depending on the customer | Uniform in the chosen storage format |
| Error message | Generic hint or none | Concrete text per store view |
| Existing data | Has to be cleaned by hand | Console command for the whole base |
| Reporting | None | Rejections and conversions per country in the admin |
How we set up Magento 2 phone validation for you
The process after you place your order.
Briefing
We clarify shipping countries, required-field rules and the storage format you prefer.
Installation
We install the module and set up Magento 2 phone validation for your store views, including checkout and address book.
Texts
We store the error messages in all shop languages and adjust the tone to your brand.
Test
We test Magento 2 phone validation with numbers from every shipping country, mobile numbers, special characters and the switch of country inside the form.
Handover
Your team gets an introduction to country rules, the report and cleaning of existing data.
Delimitation from postcode validation and address modules
The Mironsoft postcode validation checks postcodes and their match with the city. This module only handles phone numbers: length, prefix and notation. The two complement each other in the address form because Magento 2 phone validation and postcode validation work on different fields.
All modules can be combined. The interface runs on Alpine.js in the Hyvä theme without jQuery or Knockout. Whether a phone number counts as personal data in your case is for you as the shop operator to assess.
No download, but personal setup
Phone Number Validation is not listed here as a ready-made download for self-installation. The purchase is a commission: after the order we get in touch, install the module in your shop and agree country rules, storage format and error texts together with you.
Frequently asked questions
Everything about country rules, format, cleaning existing data and how the purchase works.
How can I set up Magento 2 phone validation?
How can I make the phone field required in Magento 2?
Which format is stored?
Does the check work for every country?
How can I clean existing phone numbers in Magento 2?
Are numbers sent to external services?
Does Magento 2 phone validation work with Hyvä?
Are orders created in the admin checked?
How is this different from postcode validation?
Can I download and install the module myself?
Magento 2 Phone Validation – Mironsoft Phone Number Validation