Apply default shipping address on shipping estimation in Magento

If you like to show the shipping rates on the cart page, you should enter the default address in the shipping settings and apply the following change.

In the file app/code/core/Mage/Checkout/Model/Session.php you should find the following line:

$this->_quote = $quote;

And add this code before it:

$sha = $quote->getShippingAddress();
if (!$sha->getCountry()) {
  $country = Mage::getStoreConfig('shipping/origin/country_id');
  $state = Mage::getStoreConfig('shipping/origin/region_id');
  $postcode = Mage::getStoreConfig('shipping/origin/postcode');
  $quote->getShippingAddress()
    ->setCountryId($country)
    ->setRegionId($state)
    ->setPostcode($postcode)
    ->setCollectShippingRates(true);
  $quote->save();
}

In this code we are checking if the quote address country is set. And if it is not, we are set the default address for the current cart/quote.