protected function _findDelivCountry()
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $oUser = $this->getBasketUser();

        $sDeliveryCountry = null;

        if (!$oUser) {
            // don't calculate if not logged in unless specified otherwise
            $aHomeCountry = $myConfig->getConfigParam('aHomeCountry');
            if ($myConfig->getConfigParam('blCalculateDelCostIfNotLoggedIn') && is_array($aHomeCountry)) {
                $sDeliveryCountry = current($aHomeCountry);
            }
        } else {
            // ok, logged in
            if ($sCountryId = $myConfig->getGlobalParameter('delcountryid')) {
                $sDeliveryCountry = $sCountryId;
            } elseif ($sAddressId = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('deladrid')) {
                $oDeliveryAddress = oxNew(\OxidEsales\Eshop\Application\Model\Address::class);
                if ($oDeliveryAddress->load($sAddressId)) {
                    $sDeliveryCountry = $oDeliveryAddress->oxaddress__oxcountryid->value;
                }
            }

            // still not found ?
            if (!$sDeliveryCountry) {
                $sDeliveryCountry = $oUser->oxuser__oxcountryid->value;
            }
        }

        return $sDeliveryCountry;
    }