I forgot the line code:
/**
* Returns the country code for the country that applies to the order.
* It only takes into account what has actually been saved.
* @return String (country code)
**/
public function Country() {return $this->getCountry();}
public function getCountry() {
$countryCodes = array(
"Billing" => "",
"Shipping" => ""
);
if($this->BillingAddressID) {
$billingAddress = BillingAddress::get()->byID($this->BillingAddressID)
Line 1978 if($billingAddress) {
if($billingAddress->Country) {
$countryCodes["Billing"] = $billingAddress->Country;
}
}
}
if($this->ShippingAddressID && $this->UseShippingAddress) {
$shippingAddress = BillingAddress::get()->byID($this->ShippingAddressID)
if($shippingAddress) {
if($shippingAddress->ShippingCountry) {
$countryCodes["Shipping"] = $shippingAddress->ShippingCountry;
}
}
}
if(count($countryCodes)) {
if(EcommerceConfig::get("OrderAddress", "use_shipping_address_for_main_region_and_country") && $countryCodes["Shipping"]) {
return $countryCodes["Shipping"];
}
return $countryCodes["Billing"];
}
}