woocommerce / woocommerce

A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
https://woocommerce.com
9.33k stars 10.75k forks source link

Phone # Format Validation #2157

Closed pnommensen closed 11 years ago

pnommensen commented 11 years ago

Please consider adding some type of phone # verification check based off of country selected. For example, US phone numbers should only be 10 digits or 11 digits if it starts with a 1.

ctalkington commented 11 years ago

i'm not sure i've seen many ecom that actually validate phone numbers because they vary so much. you can always use hooks to do your own validation on submit.

EDIT: guess a few do validate number of digits but i see a lot of people looking for ways to disable the validation so i think it really just depends. it wouldn't be too hard to strip all chars and run a few checks but i'm not sure how reliable it would be.

pnommensen commented 11 years ago

Although it's not commonly referenced, there is an international format. See http://en.wikipedia.org/wiki/E.164. It would require a pretty a substantial amount of code for a small feature. However, it would be nice for WooCommerce to at least recognize that US phone numbers shouldn't be more than X digits, ect.

maxrice commented 11 years ago

e.164 formatting isn't that difficult if you know the country the phone number is in, but it's probably best to not force any kind of validation, since a customer might want to add an extension to a phone number (e.g. 310-867-5309 ext 123) or some other additional information. It's easy enough to hook in and do your own validation as required anyway :smile:

mikejolley commented 11 years ago

I don't think we should verify it - its not worth adding something which could potentially disrupt checkout and prevent a sale.

FYI there is a very basic is_phone check which checks allowed characters already ( - . 0-9 ( ) )

alexJunger commented 9 years ago

Is there a way to overwrite is_phone of WC_Validation, without tinkering in the core file? I'm thinking about extending WC_Validation and overwriting it there, but I couldn't find any documentation about such manipulations.

Roemerb commented 7 years ago

Hi, I realize this is an old issue but I have a need for it. I work for a payment service provider that facilitates online payments for multiple payment services like Klarna and SEPA/Direct Debit. These services require customer information to be submitted alongside payment information (and so do all other pay-later services). All of these require the phone number to be in the E. 123 format. I will now manually hook in to change it but perhaps this may be a consideration.

sknichols commented 3 years ago

Honestly, I don't understand why WooCommerce doesn't have more settings for Checkout to prevent checkout errors. We have TONS of orders with email typos (e.g., @ail.com, @yahop.com, etc.), and we also have people who don't want to give their phone number and type 25 digits into the phone field. When both happen (you'd be surprised; people are dumb), we have no way of contacting the customer to verify their order. When analyzing their site behavior, IP, payment and shipping info, etc., their transactions appear legitimate otherwise.

Having a phone number verification (just format) for USA stores and some kind of email verification would be fantastic. The existing tools out there don't seem to integrate with the checkout process very well, so we still have issues with this even after paying a pretty good amount of money to prevent it.