Knowledgebase

How to remove the fax field from the checkout page in Magento

The fax field that's displayed at the billing address and shipping address steps of the checkout page in Magento is an optional field, and so customers don't need to put anything in that field to be able to place an order. Nevertheless, if you want to hide the fax field from being displayed on the checkout page, you can do that with a few changes to some of the Magento files.

Since the fax field is an optional field you only need to remove it visually; there's no need to disable any validation. You need to edit two files labeled billing.phtml and one called shipping.phtml.

Assuming that your Magento is installed directly in the public_html directory on your Magento hosting account (making the frontend accessible at yourdomain.com) and that you use the default theme that comes prepackaged with Magento, then the path to the first billing.phtml file will be public_html/app/design/frontend/base/default/template/checkout/onepage/billing.phtml. Find and comment out the following code (around line 125):

<div class="field">
<label for="billing:fax"><?php echo $this->__('Fax') ?></label>
<div class="input-box">
<input type="text" name="billing[fax]" value="<?php echo $this->escapeHtml($this
->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" 
class="input-text <?php echo $this->helper('customer/address')
->getAttributeValidationClass('fax') ?>" id="billing:fax" />
</div>
</div>

To comment it out put an exclamation mark and two hyphens after the first bracket (e.g. <!--div) and two hyphens before the last one (e.g. /div-->). You can edit the file from the Files section of the Pixie control panel. Or you can download it on your local computer with an FTP client (e.g. FileZilla), edit it with a text editor (e.g. Notepad, Wordpad) and upload it back in the same folder overwriting the old file.

With the default theme and public_html being the root Magento folder on your hosting account, the path to the shipping.phtml file will be public_html/app/design/frontend/base/default/template/checkout/onepage/shipping.phtml. In that file comment out the code (around line 116):

<div class="field">
<label for="shipping:fax"><?php echo $this->__('Fax') ?></label>
<div class="input-box">
<input type="text" name="shipping[fax]" value="<?php echo $this->escapeHtml
($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" 
class="input-text <?php echo $this->helper('customer/address')
->getAttributeValidationClass('fax') ?>" id="shipping:fax" 
onchange="shipping.setSameAsBilling(false);" />
</div>
</div>

The path to the other billing.phtml file that you have to modify would be public_html/app/design/frontend/base/default/template/persistent/checkout/onepage/billing.phtml. Comment out the code (around line 126):

<div class="field">
<label for="billing:fax"><?php echo $this->__('Fax') ?></label>
<div class="input-box">
<input type="text" name="billing[fax]" value="<?php echo $this->escapeHtml
($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" 
class="input-text <?php echo $this->helper('customer/address')
->getAttributeValidationClass('fax') ?>" id="billing:fax" />
</div>
</div>

After you make these three modifications refresh the frontend of your site and check the results.

In case you also want to hide the fax field on the add/edit address form of the customer account settings read the article on removing the fax field from the frontend customer account settings in Magento.

If you don't want to modify the code of the files of the original theme, you can create a child/subtheme, make the changes to that theme, and make it the default theme. For more information read the article on creating a subtheme in Magento.

If you want to remove some of the other fields that appear on the checkout page, you may find useful the articles on:

Was this answer helpful?

 Print this Article

Also Read