Skip to content

How to dynamically adjust phone number validation length based on selected country in checkout form

I have a phone number field in the address form during checkout, and I want to modify the validation based on the selected country from the country dropdown. Specifically, I would like to adjust the min_text_length and max_text_length values. For one country, I want the length of the phone number to be 10, and for another country, I want it to be 12.

enter image description here

How can I implement this conditional validation?