voodish logo
tweet rss book of faces Linked In

Make ‘Ship to This Address’ Default in Magento Checkout

magento under construction

This code will allow you to preselect the ’ship to address’ during your Magento checkout. Most often customers will not require shipping to multiple addresses therefore the preselected option should be automatically set to ‘Ship to this Address’.

This really should be setup as core, or at least an option in the admin section, but for the time being here’s how to make the change.

Bespoke or default template

Good practice would dictate to do this within your bespoke template.

Either Locate your template over-ride file:

app/design/frontend/< yourtheme >/< yourtheme >/template/checkout/onepage/billing.phtml

OR locate the generic system file:
app/design/frontend/base/default/template/checkout/onepage/billing.phtml

After the Line:

<?php of ($this->canShip()): ?>

OR Line (depending on generic or over ride):

<form id="co-billing-form" action="">

Add the following:

<?php
      $session = Mage::getSingleton('core/session');
      if (intval($session->getPreselectedAddressOption()) !== 1) {
          $session->setPreselectedAddressOption('1');
          $this->getQuote()->getShippingAddress()->setSameAsBilling(true);
      }
?>

Publically facing Output

ship-to-this-address-magento.gif

Related Articles

Comments RSS Feed

3 Comments

  1. tinman April 6, 2011

    Absolutely should be core this.. nice fix thanks

  2. Go to Top of the page

  3. Pavel June 3, 2011

    thanks

  4. Go to Top of the page

  5. Ankit Sharmaa July 28, 2011

    Thanks

  6. Go to Top of the page

Leave a comment