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.
4 Answers
As these fields are not required you can simply remove them from the following template file.
- /app/design/frontend/base/default/template/checkout/onepage/billing.phtml
- /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.
-
thank you! So normally if I am editing a file I usually just copy it and add it to my child theme and make the edits there. Is the XML way you suggested a better way to do things? Commented Oct 25, 2013 at 21:05
-
basically it allows you to easily change/update themes. a good article is classyllama.com/development/magento-development/… Commented Oct 26, 2013 at 7:38
Both fields are not required, therefore not checked server side. Just remove them from the template.
-
Do you know where I would find the template to edit these files? Commented Oct 24, 2013 at 20:40
-
I think @david-manners answered your question :) Commented Oct 26, 2013 at 9:47
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
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.