Originally Posted by
infinigrove
I see this thread is a year old but I was having the same problem with the latest version of the TaxCloud module with ZC v1.5.5f
It was giving me "Error encountered looking up tax amount The Ship To State (Ne) is not valid" when trying to do New York (NY) state or any other state where the 2-Letter state code was not the first 2 characters of the state name.
What I did to resolve this issue is first modify includes/classes/order.php to lookup the zone_code in the $shipping_address_query around line 270 by changing:
$shipping_address_query = "select ab.entry_firstname, ab.entry_lastname, ab.entry_company,
ab.entry_street_address, ab.entry_suburb, ab.entry_postcode,
ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id,
c.countries_id, c.countries_name, c.countries_iso_code_2,
to
$shipping_address_query = "select ab.entry_firstname, ab.entry_lastname, ab.entry_company,
ab.entry_street_address, ab.entry_suburb, ab.entry_postcode,
ab.entry_city, ab.entry_zone_id, z.zone_name, z.zone_code, ab.entry_country_id,
c.countries_id, c.countries_name, c.countries_iso_code_2,
Then I added a state_code to the delivery array that contains the zone_code around line 424.
So that this:
$this->delivery = array('firstname' => $shipping_address->fields['entry_firstname'],
'lastname' => $shipping_address->fields['entry_lastname'],
'company' => $shipping_address->fields['entry_company'],
'street_address' => $shipping_address->fields['entry_street_address'],
'suburb' => $shipping_address->fields['entry_suburb'],
'city' => $shipping_address->fields['entry_city'],
'postcode' => $shipping_address->fields['entry_postcode'],
Now looks like:
$this->delivery = array('firstname' => $shipping_address->fields['entry_firstname'],
'lastname' => $shipping_address->fields['entry_lastname'],
'company' => $shipping_address->fields['entry_company'],
'street_address' => $shipping_address->fields['entry_street_address'],
'suburb' => $shipping_address->fields['entry_suburb'],
'city' => $shipping_address->fields['entry_city'],
'postcode' => $shipping_address->fields['entry_postcode'],
'state_code' => $shipping_address->fields['zone_code'],
Then I modified the includes/modules/TaxCloud/func.taxcloud.php to use the state_code instead to the state on line 98 by replacing:
$destination->setState($delivery['state']); // Two character state appreviation
with
$destination->setState($delivery['state_code']); // Two character state abbreviation
Hope this helps.