Javascript Validation Customization

The WP EasyCart is setup to validate at the very minimum for non-US customers. This is because validation requirements vary so much from country to country. To make the system as flexible as possible, there is the opportunity to add custom validation for each and every country and a backup validation for those countries that are not specifically specified.

All validation is available in your theme folder, wp-content/plugins/wp-easycart-data/design/theme/{your theme}/ec_validation.js

If you do not know what your theme is, click here to learn how to figure that out.



As you can see from this function example, the javascript validate function takes a ‘function_name’ and a ‘country_code’. If your country had, for example, a specific address format, you could edit the way the ‘input’ value is validated. If you often sell to the US and UK, you could add an ‘else if’ statement to validate the two countries differently.

Here is a nice example of how you would improve the state validation to check for a correct entry of a Canadian province. The addition is the ca_provinces variable as well as the ‘else if’ for the ‘country_code’ “CA”.