kowal.info

Checkout Phone Validation

Composer kowal/module-checkoutphonevalidation · Version 1.0.2

Product page

A product page on kowal.co has not been confirmed.

Description

Validates the telephone field in the standard Magento checkout address form.

For whom

For stores collecting contact numbers through Magento’s standard checkout address form.

Features

  • Make telephone entry mandatory.
  • Apply a minimum text length of nine characters.
  • Use the standard Magento numeric validator on the field.

Installation

From the Magento root, with Composer access to the Kowal package, run

composer require kowal/module-checkoutphonevalidation
bin/magento module:enable Kowal_CheckoutPhoneValidation
bin/magento setup:upgrade
bin/magento cache:clean

Configuration

Once enabled, the extension sets required-entry, min_text_length with a value of 9, and validate-number on the telephone field. This makes the field mandatory, checks for at least nine characters and applies Magento’s numeric validator.

The first street line also receives a rule named validate-adres. Version 1.0.2 references this rule but does not ship its JavaScript implementation. House-number validation requires the storefront to register the rule.

Requirements / notes

These rules apply to checkout form input. Include representative international formats in acceptance tests for each store view.

FAQ

Does a nine-character value always pass?

Length is only one check. The field must also pass Magento’s numeric validation. Test the exact format your customers enter.

Verify the installation

In a test checkout, try continuing with an empty telephone field, then with 12345678 and finally with 123456789. With other fields valid, the first two attempts should show a telephone error. Test international formats used by your customers and the street field separately.