When it’s time for your customers to checkout, Shopp runs a number of different validation processes to help detect any mistakes that the customer might have made – such as entering their email address incorrectly, or forgetting to provide their name – and also to ensure that you, as the merchant, have all the information…

How to Disable Checkout Validation

How to Disable Checkout Validation

When it’s time for your customers to checkout, Shopp runs a number of different validation processes to help detect any mistakes that the customer might have made – such as entering their email address incorrectly, or forgetting to provide their name – and also to ensure that you, as the merchant, have all the information you require for business purposes.

There are occasions however where some or possibly all of those validation processes are going to be undesirable. For this walkrthrough, I’m to focus on how to disable or modify those processes to better fit your needs.


Before we begin: a warning.

Shopp performs a comprehensive set of validation checks by default and that’s for a good reason – they are a set of rules that help to ensure your store will play nicely with the majority of payment gateways out there (and they can also prevent a loss of sanity by prompting customers to correct silly mistakes that could otherwise make interaction more challenging later on).

So, before you tamper with this stuff, it’s well worth spending some time thinking hard about possible complications that may occur further down the line. Now let’s look at some basic aspects of the validation process.

  • Required fields are those fields, such as the first name and last name, which cannot be left empty
  • Validated fields take this a step further. Not only are they required but they must meet some sort of criteria to be acceptable. A good example is an email address: Shopp won’t accept “random text” here, but it will accept “barry@email.com”
  • Client side validation is the set of checks that run within your customer’s browser. This is fantastic because the customer gets near-instant feedback, but we can’t rely on this alone because Javascript (on which it depends) can be turned off or may even stop working if other plugins introduce errors
  • Server side validation happens when the client-side checks are satisfied and the checkout page is actually submitted. This is an essential layer and could be perceived as the “last line of defense”

As you can see, there are a number of different facets to this and generally speaking we have to remember to make our changes on more than one level.

Required fields

Let’s look at a snippet from the checkout.php template.

    <label for="firstname"><?php _e('Contact Information','Shopp'); ?></label>
    <span><?php shopp('checkout','firstname','required=true&minlength=2&size=8&title='.__('First Name','Shopp')); ?><label for="firstname"><?php _e('First','Shopp'); ?></label></span>
    <span><?php shopp('checkout','lastname','required=true&minlength=3&size=14&title='.__('Last Name','Shopp')); ?><label for="lastname"><?php _e('Last','Shopp'); ?></label></span>
    <span><?php shopp('checkout','company','size=22&title='.__('Company/Organization','Shopp')); ?><label for="company"><?php _e('Company/Organization','Shopp'); ?></label></span>
    <span><?php shopp('checkout','phone','format=phone&size=15&title='.__('Phone','Shopp')); ?><label for="phone"><?php _e('Phone','Shopp'); ?></label></span>
    <span><?php shopp('checkout','email','required=true&format=email&size=30&title='.__('Email','Shopp')); ?>
    <label for="email"><?php _e('Email','Shopp'); ?></label></span>

This is the code that generates the Contact Information section on the checkout page and it contains fields for the customer’s first name, last name, company/organization, phone and email. If you look through each template tag you will see that some of the fields contain parameters relating to client side validation.

For example, the first name field has been set up using these parameters:


That means not only is the field is required but it must contain at least 2 characters. The company field on the other hand contains no such checks – so customers can leave it completely empty. Looking further down we can see the following parameter being used for the phone field:


This time there is nothing to say that it is required, so customers needn’t complete it. What the above parameter is saying however is that if a phone number is provided it ought to be a valid format.

Screenshot of Shopp checkout contact fields

This screenshot shows client side validation at work. My company and phone fields are blank – that’s ok because they aren’t required – but my first name field has been highlighted because I have provided only an initial when it’s been stipulated that not only is it required, but at least 2 characters are needed for this to be acceptable.

Changing the validation properties

Let’s suppose that we are quite happy for customers to provide only an initial for the first name field. We would then change the relevant parameters to:


We might also change the minlength parameter for the lastname field so that it accepts 2 characters (instead of 3) – this could accommodate short last names which are popular in many cultures.

Last but not least, let’s suppose we absolutely require a phone number (perhaps the nature of what you sell is such that you need an emergency contact number for the customer). In that case, we’d simply add:


To our phone field parameters. Simple, right? Of course it is. Here’s the complete code for these changes:

    <label for="firstname"><?php _e('Contact Information','Shopp'); ?></label>
    <span><?php shopp('checkout','firstname','required=true&minlength=1&size=8&title='.__('First Name','Shopp')); ?><label for="firstname"><?php _e('First','Shopp'); ?></label></span>
    <span><?php shopp('checkout','lastname','required=true&minlength=2&size=14&title='.__('Last Name','Shopp')); ?><label for="lastname"><?php _e('Last','Shopp'); ?></label></span>
    <span><?php shopp('checkout','company','size=22&title='.__('Company/Organization','Shopp')); ?><label for="company"><?php _e('Company/Organization','Shopp'); ?></label></span>
    <span><?php shopp('checkout','phone','required=true&format=phone&size=15&title='.__('Phone','Shopp')); ?><label for="phone"><?php _e('Phone','Shopp'); ?></label></span>
    <span><?php shopp('checkout','email','required=true&format=email&size=30&title='.__('Email','Shopp')); ?>
    <label for="email"><?php _e('Email','Shopp'); ?></label></span>

We’ve now got a lot more lattitude for the customer name fields, and we can also flag up to the user that the phone number is required.

Screenshot of the contact fields (validation has been modified)

Of course, as you hopefully already know, these changes should be made using theme templates – editing the core plugin’s template files is a bad thing and you will probably end up losing all of your hard work the next time Shopp is updated.

Working on two levels

Hopefully you now have a good grasp of what is happening and how client side validation is implemented. As we covered at the beginning, however, client side validation is just part of the picture and we also have to consider server side validation.

Let’s now suppose that, actually, we don’t even need the customer’s first or last name (perhaps they are buying some sort of digital download and we simply don’t need that information). Enforcing this on the client side layer is pretty easy – we just remove the required and minlength properties from the template tags.

<span><?php shopp('checkout','firstname','size=8&title='.__('First Name','Shopp')); ?><label for="firstname"><?php _e('First','Shopp'); ?></label></span>
<span><?php shopp('checkout','lastname','size=14&title='.__('Last Name','Shopp')); ?><label for="lastname"><?php _e('Last','Shopp'); ?></label></span>

Screenshot showing a Shopp checkout validation error Goodbye Javascript checks! But if you actually try this out by making the above changes and submitting a checkout form without a first or last name, you’ll see that an error appears at the top of the checkout page reading, “You must provide your first name.”

This is, of course, the result of the second round of checks which are run by Shopp server-side – and what we need to do now is find a way to eliminate those checks.

Just as with our template changes the last thing we want to do is edit core plugin code – and we don’t have to. The following snippet can be placed in your theme’s functions.php file (advanced users might want to place it inside a plugin) and effectively turns off the server side requirement for a first and last name:

 * Used to indicate when fields are not required.
 * @return bool false
function field_is_not_required() { return false; }

 * Used to indicate when fields may be empty.
 * @return bool true
function allow_to_be_empty() { return true; }

// Stop Shopp from requiring first names
add_filter('shopp_firstname_required', 'field_is_not_required');
add_filter('shopp_ordering_empty_firstname', 'allow_to_be_empty');

// Stop Shopp form requiring lastnames
add_filter('shopp_lastname_required', 'field_is_not_required');
add_filter('shopp_ordering_empty_lastname', 'allow_to_be_empty');

This is fairly straightforward – we are using hooks provided by Shopp for this very purpose to turn off the (server-side) requirement for first and last names – and we’re doing it without modifying any core code.

What about all the other fields?

Shopp is packed with action and filter hooks that make it extremely flexible – there are lists here and here – and here are some that you are likely to be interested in when working with the validation process:

  • shopp_billing_address_required
  • shopp_billing_country_required
  • shopp_billing_postcode_required
  • shopp_firstname_required
  • shopp_lastname_required
  • shopp_login_required

In some circumstances you may also be interested in these filters:

  • shopp_billing_cardexpires_month_required
  • shopp_billing_cardexpires_year_required
  • shopp_billing_cardholder_required
  • shopp_billing_cardtype_required
  • shopp_billing_cvv_required

The actual process is going to be pretty much the same as we have already covered for first and last names. The key is to remember that for many fields there are two layers of validation – client and server – and that both need to be addressed.

Some final words of warning are to consider the consequences of removing validation. There is no point in removing validation of key fields from Shopp, for example, if it means the process will ultimately be stopped by the payment processor because what are vital bits of information from their perspective are missing. So research, test and test again before you put your changes into practice in a live environment.

That gives you a good overview of what is required. If you have any questions, comments or corrections to suggest – please just leave a comment!


Barry Hughes is an independent web developer specializing in PHP and WordPress. When he isn’t putting together plugins or baking up other tasty morsels of code he tries his best to update his blog at FreshlyBakedWebsites.net.

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.