Open JeffPyeBrook opened 10 years ago
Strikes me as pretty hard (impractical?) to do in a way that works internationally.
Can we just go with a well placed filter of the return value from wpsc_have_valid_shipping_zipcode and let local devs implement validators for their chosen countries with plugins - would also support people who wanted to restrict shipping to only certain postal code regions / ranges?
@leewillis77 Yep, I'd agree.
My thought was to include a very basic validation callback/filter in the component, that would leverage additional functionality within shipping plugins. That way each shipping plugin could add to the functionality for locations and methods it supports.
And you are correct in that it is complicated. Even in the US it is not as simple as validating against a list of known zip codes. For example, certain USPS shipping methods and options require the zip+4, so the meaning of what a valid zipcode is can change on the fly. And some zip codes are not eligible for some rates. You need to use the correct USPS address cleansing and rating functionality to get to the right answer.
See function _wpsc_have_valid_shippingzipcode
New shipping component should include a validate postal code method