Knowledgebase

How to remove the ZIP/Postcode field from the frontend customer account settings in Magento

As you know, registered customer can add and edit their addresses from their account settings on the frontend. If you want to, you can remove the zip/postcode field from the add/edit address form. To do this you have to make a few modifications. One in the database in which your Magento is installed, one to a Magento file on your account called Abstract.php. To learn how to do these two modifications read the relevant parts of the article on removing the postcode field from the checkout page in Magento. In that article, of course, you can find the full information on how to remove the postcode field from the checkout page.

If you have performed these two modifications, what's left is to visually remove the field from the add/edit address form in the customer account settings. To do this you need to edit a file called edit.phtml. If your Magento is installed directly in the public_html directory on your Magento hosting account and you use the default theme that comes prepackaged with Magento, the path to the file will be public_html/app/design/frontend/base/default/template/customer/address/edit.phtml. Find and comment out the code:

<div class="field">
<label for="zip" class="required"><em>*</em>
<?php echo $this->__('Zip/Postal Code') ?></label>
<div class="input-box">
<input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->
getAddress()->getPostcode()) ?>" title="<?php echo $this->__
('Zip/Postal Code') ?>" id="zip" 
class="input-text validate-zip-international <?php echo $this->
helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
</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 bracket (e.g. /div-->). You can edit the file from the Files section of the Pixie control panel. Alternatively, 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 on your hosting account overwriting the old file.

When it comes to removing or making optional fields on the add/edit address form in the customer account settings you may also find useful the articles on:

Was this answer helpful?

 Print this Article

Also Read