0

When we define a default billing address and a default shipping address for a customer, the (onepage) checkout automatically selects "Ship to this address" while choosing the billing address.

Users obviously do not read this, proceed with the checkout and the default shipping address gets changed to the default billing address.

I thought, that the checkout would behave in a way that "Ship to a different address" would be selected if billing and shipping address were not the same.

Is this some backend misconfiguration or do I need to work on the checkout itself to check whether the addresses are the same or not and set the radio buttons regarding to this?

0

It seems like the function isUseBillingAddressForShipping() (search for that here on MAGE:SO) seems to be broken, at least on our systems. Whatever you choose in the backend, this function always returns true.

If that value would change, the checkout with automatic selection of billing/shipping address would most probably work. That is at least how it's supposed to work with the default Onepage Checkout.

We have implemented the following solution to this issue:

First copy the app/design/frontend/base/default/template/checkout/onepage/billing.phtml to your own theme, so it could look like this: app/design/frontend/your-theme/default/template/checkout/onepage/billing.phtml

Around line 186 in that file you will find a block that starts with <?php if ($this->canShip()): ?> which then takes care about outputting the radio buttons.

Add the following block right after the previous PHP if-clause:

<?php
   $customer = Mage::getSingleton('customer/session')->getCustomer();
   $ShippingIsBilling = false;
   if($customer[default_billing] === $customer[default_shipping])
      { $ShippingIsBilling = true; }
?>

This will get the logged in customers object (only logged in customers can have saved addresses). This object stores links to the default billing and shipping address ID. When those IDs match, billing and shipping address are the same.

You can now simply change any calls for $this->isUseBillingAddressForShipping() change for $ShippingIsBilling. Other changes are not needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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