BillingState is only sent to sagepay if BillingCountry == ‘US’, and DeliveryState is only sent if DeliveryCountry ==“US”.
However, DeliveryState should default to $this->order(‘state’) if $this->order(‘shipping_state’) is empty. [See line 189 of Cartthrob_sage].
I suggest that you insert the following lines (marked with “>>>>”):
if ("US" != $post_array['DeliveryCountry'])
{
$post_array['DeliveryState'] = "";
}
else
{
$post_array['DeliveryState'] = strtoupper($this->order('shipping_state'));
}
if ("US" != $post_array['BillingCountry'])
{
$post_array['BillingState'] = "";
}
else
{
$post_array['BillingState'] = strtoupper($this->order('state'));
>>>>> if($post_array['DeliveryState'] == ""){
>>>>> $post_array['DeliveryState'] = $post_array['BillingState'];
>>>>> }
}
