Address Validation for 0.7.2

freshjonesfreshjones Member
in Help edited September 2012
Hi guys,

My client is looking to ensure that customers enter valid shipping address information when checking out. Is there any way to validate that the street address matches the postal code and state? I know that if I enter a zipcode that does not match the state it will throw an error right? but is there a way to ensure the address is correct too? If a customer enters an incorrect shipping address and the shipment gets returned then there would be additional charges, which he's trying to avoid.

thanks
Comments
  • sparkwebsparkweb Member, Integration Developer, FoxyShop, Order Desk
    @freshjones If you are using live rates, you'll get an error if the zip code doesn't match the city/st. If you wanted to get actual address validation you'd have to use a third-party service (maybe you could use your shipper with an API on your own site) and then overload the updatetax action (see how the Multiple Flat Rate script does it) and then call the script on your server to get the results, then feed the results back and act on them. Some things to keep in mind:

    Your site will have to have an SSL cert so you don't trigger errors

    Your site should be setting the allow external scripts to hit it by setting this header:

    header('Access-Control-Allow-Origin: *');

    IE doesn't support cross-site scripting natively (even with jQuery). You have to use XDomainRequest if it's IE: https://www.google.com/search?q=xdomainrequest. If/when you get this far, I have sample code for the ajax piece that I could share with you.

    That's a lot of technical stuff and maybe more than you were looking for. But there you go....
  • Thanks for the advice, I'll look into it and see if its worth the effort for my client.
Sign In or Register to comment.