Home > Magento Tips > Disable Alternative Shipping Address

Disable Alternative Shipping Address

Posted on: 10th Aug 2010 By: Robert Kent No Comments

Paypal has issues. The main issue though is the way PayPal reacts when it does not receive the billing address. Unfortunately PayPal only processes card payments if it has the billing address for that card – if you are shipping a product to somewhere else then problems occur…

To counter this, on one of our websites we dove into the code and pre-ticked a few features so that the shipping address is skipped.

Here’s how we did it:

Go into your template/checkout/onepage/billing.phtml

Create a div class with display none around the following code:

<div style="display:none;">

<?php if ($this->canShip()): ?>
<li>
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1" checked="checked"title="<?php echo  $this->__('Ship to this address') ?>" onclick="$('shipping:same_as_billing').checked = true;" /><label for="billing:use_for_shipping_yes"><?php echo  $this->__('Ship to this address') ?></label></li>
<li>
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0" title="<?php echo $this->__('Ship to different address') ?>" onclick="$('shipping:same_as_billing').checked = false;" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
</li>
<?php endif; ?>
</ul>
<?php if (!$this->canShip()): ?>
<input type="hidden" name="billing[use_for_shipping]" value="1" />
<?php endif; ?>

</div>

Notice how we’ve removed the if statements that allow the checked=”checked” and only placed it on the use for shipping_yes.

Next we open up our template/checkout/onepage/shipping.phtml and simply display: none; the whole thing. Wrap a div around it again.

You can also add a line of code in there to say something like “we currently only accept one address that is the billing address for our products”.

There you go.

Thanks for visiting e-commerce website design and our Magento Blog!

Post A Comment

Your comments:
Enclose code snippets within the appropriate tags: [php][/php]   [js][/js]   [xml][/xml]   [css][/css]   [html][/html]
E.g: [php]<?php echo "hello world"; ?>[/php]

Search Blog

Archives

For the record...

Views & opinions in this blog are those of the individual and do not necessarily reflect those of E-commerce Web Design or the Creare Group.