5

I want to apply some custom validation on shipping address form of Magento 2 Checkout. Normally i do it with JQuery but don't know how to apply it in Magento 2.

The validation i want to implement are mentioned below.

  • Allow only alphabet on some field.
  • Allow dash (-) , hash (#) , both slash (/ , ) and dot (.) in the address1 field

  • Allow only digits in the ZIP field

  • Allow only numbers in PhoneNumber field
  • Set Max length to 50 for First Name, Last Name and Company
  • Set Max length to 5 Digits for Zip code.
  • Set Max length to 20 for City
  • Set Max length to 10 Digits for Phone Number.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.