Magento Themes and Magento Extensions

Make ‘Ship to This Address’ Default in Magento Checkout

Share

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);
      }
?>

Leave a Reply

You must be logged in to post a comment.