How can I set my default shipping method in the shopping cart to the country where my store is?

For instance, I want to set the default shipping method to the UK when the customer are on the shopping cart page.

By Magento default, you have to select your country where you want to ship your order to. Then you have to hit the button 'Get a quote' for the 'Estimate Shipping and Tax'. But I want to skip this step by setting the default shipping method to the UK automatically when you are on this page.

Is it possible?

I tried with this code below,

$shippingAddress = $this->getQuote()->getShippingAddress();

But you have to refresh the shopping cart page for a couple of times before it sets the shipping method to the UK.

I need it set the shipping method to the UK as soon as you land on the shopping cart page though, is it possible?

  • Don't forget, the ISO alpha-2 code for the United Kingdom is GB.
    – Nick
    Commented May 22, 2015 at 12:30

3 Answers 3


I used this method just so I could change the css on the <select> element but it makes it easier to "filter" countries and what not as well, which could help you.

Go to /app/design/frontend/THEME_NAME/default/template/checkout/cart/shipping.phtml

Try replacing:

<?php echo Mage::getBlockSingleton('directory/data')->getCountryHtmlSelect($this->getEstimateCountryId()) ?>

With this:

<?php $_countries = Mage::getResourceModel('directory/country_collection')->loadByStore()->toOptionArray(false) ?>
<?php if (count($_countries) > 0): ?>
    <select name="country_id" id="country" class="validate-select">
        <option value="GB">United Kingdom</option>
        <?php foreach($_countries as $_country): ?>
                <option value="<?php echo $_country['value'] ?>">
                    <?php echo $_country['label'] ?>
        <?php endforeach; ?>
<?php endif; ?>

Override the CartController and add this code in the indexAction

 class Ajaxy_Core_Checkout_CartController extends Mage_Checkout_CartController {  

     public function indexAction() {

            $shippingAddress = $this->_getQuote()->getShippingAddress();
            if (!$shippingAddress->getShippingMethod()) {


this works and refreshes the cart, set the country to 'US', shipping to free if the customer have no shipping method


An easier way is to change the CartController.php

Inside the indexAction() function. Add


More options?


I hope this will help someone.

  • Great Job Man :)
    – Shiv Singh
    Commented Jul 13, 2017 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.