Validation is important if you want only certain values from your customers. If the requirement is not met, the form will not be submitted and your customer will be asked to fix the error. A very good example is the email field. You would want your customer to only input strings that match this “someword@somedomain.somedomainending”. Anything other than that is unacceptable.
By default WooCommerce comes with three (3) validation rules namely
- Required
- Phone
Pluginette has added over forty-five (45) validation rules that will work perfectly well to make sure you collect the right, and only the right values.
Here is a list of all validation rules available in Checkoutplus —
Rule | Explanation | Example |
---|---|---|
required | field must contain a value, whatever the value is | required |
required_if | field is only required if another field has one or more values | required_if:billing_firstname,David,John |
required_unless | field is required unless another field has one or more values | required_unless:billing_firstname,David,John |
required_with | ||
required_without | ||
required_without_all | ||
numeric | ||
alpha | ||
alpha_num | ||
alpha_dash | ||
alpha_spaces | ||
in | ||
not_in | ||
min | ||
max | ||
between | ||
url | ||
integer | ||
boolean | ||
ip | ||
ipv4 | ||
ipv6 | ||
extension | ||
array | ||
same | ||
regex | ||
date | ||
accepted | ||
present | ||
different | ||
uploaded_file | ||
mimes | ||
callback | ||
before | ||
after | ||
lowercase | ||
uppercase | ||
json | ||
digits | ||
digits_between | ||
defaults | ||
default | ||
nullable |