Skip to content

Validation

Accept only values that you want, reject irrelevant entries.

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.

Image showing validation using WooCommerce Checkoutx

By default WooCommerce comes with three (3) validation rules namely

  • Required
  • Email
  • 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 —

RuleExplanationExample
requiredfield must contain a value, whatever the value isrequired
required_iffield is only required if another field has one or more valuesrequired_if:billing_firstname,David,John
required_unlessfield is required unless another field has one or more valuesrequired_unless:billing_firstname,David,John
required_with
required_without
required_without_all
email
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