1

What is the best way to go about removing unnecessary fields during the checkout process? I do not need to collect my customer's company name and fax number, and therefore would like to remove.

1
  • Which Edition do you want to make not required those fields, Magento 1 or Magento 2 ?
    – Thangam
    May 18 '18 at 5:56
3

As these fields are not required you can simply remove them from the following template file.

  1. /app/design/frontend/base/default/template/checkout/onepage/billing.phtml
  2. /app/design/frontend/base/default/template/checkout/onepage/shipping.phtml

But changing the core template is never the best idea for many reasons one of which being upgrade-ability. I would always suggest setting new templates via layout xml and then editing these new templates.

<?xml version="1.0"?>
<layout version="0.1.0">    
    <checkout_onepage_index>
        <reference name="checkout.onepage.billing">
            <action method="setTemplate"><template>new/checkout/onepage/billing.phtml</template></action>
        </reference>
        <reference name="checkout.onepage.shipping">
            <action method="setTemplate"><template>new/checkout/onepage/shipping.phtml</template></action>
        </reference>
    </checkout_onepage_index>
</layout>

On a side note if you ever need to find templates you can activate the template hints via the admin section

A good article from classy llama for benefits and disadvantages of layout changes via xml.

2
3

Both fields are not required, therefore not checked server side. Just remove them from the template.

2
  • Do you know where I would find the template to edit these files? Oct 24 '13 at 20:40
  • I think @david-manners answered your question :) Oct 26 '13 at 9:47
0

As these are optional fields, is there any reason not so simply blank them via css (hopefully protecting from future updates to the code itself)? For example:

input#billing\:fax {display:none;}
label[for=billing\:fax] {display: none;}
input#billing\:company {display:none;}
label[for=billing\:company] {display: none;}

The colon is a pain admittedly, but it does work

0

The answer that was voted correct (https://magento.stackexchange.com/a/9958/9542) seems overkill to me. While there are multiple methods to do this, that being one, I think the better way is to simply update the files in your custom theme. If you do not have one, you can make a new one, set your configuration to the new template path. If those are the only literal changes you are making, your theme folder will only have the folders and files for those two items that you will copy over from the base theme.

checkout/onepage/billing.phtml checkout/onepage/shipping.phtml

You will grab these from \app\design\frontend\base\default\template\checkout\onepage\

Then copy them into:

\app\design\frontend\YOURTHEMEPACKAGE\YOURTHEMENAME\template\checkout\onepage\

Make your changes to the file, and be sure your theme is set in the administration backend (System > Configuration > Design).

This will still keep your site "upgrade friendly" as the files in the base theme are still in-tact.

0

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. ). 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.

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.