You have your online store all setup but the client calls you and says that they really don’t need the Fax field in the registration form because they don’t really use one. So they want you to remove registration form field in OpenCart and get rid of those fields that actually make visitors annoyed. There are fields that can be easily removed but there are also mandatory fields that require more detailed attention. This post describes how to remove registration form field in OpenCart that is not mandatory such as the Fax form field.
Mandatory form fields in OpenCart are based on PHP error handling. If you delete the field from the template file, the PHP code is still going to look for that field and if it doesn’t find a value for it, it will throw an error.
Since the Fax form field is non-required field (same as fields Company and Address 2) you may just delete them from the template file and you’re done. PHP won’t bother you with any errors. So here is what needs to be done.
1. Locate the theme template file – register.tpl
If you are using a default OpenCart theme then your template file is located in:
If you are using some other theme then the path is slightly different:
2. Locate the Fax form field code
The code for this field should be around line 47 (Version 1.5.x):
</tr> <td><?php echo $entry_fax; ?></td> fax" value="php echo $fax; ?>" /></td> </tr>
For Version 2.x the code for Fax field is around line 81:
<div class="form-group"> <label class="col-sm-2 control-label" for="input-fax"><?php echo $entry_fax; ?></label> <div class="col-sm-10"> fax" value="php echo $fax; ?>" placeholder="php echo $entry_fax; ?>" id="input-fax" class="form-control" /> </div> </div>
I recommend to comment the code rather than to delete it, because there will be some cases after you remove registration form field in OpenCart that your client might change their mind and want you to put the field back in its original place.
3. Copy the register.tpl file back to the server
And you’re done! Once you copy the file back to its location and reload the registration page, you should NOT see the Fax form field. That’s how you remove a non-mandatory registration form field in OpenCart.
Please note that post code field is by default non-mandatory, but if you wish you can make it mandatory in the Dashboard settings by following these steps:
1. Navigate to: System⇒Localisation⇒Countries
2. Select the country to which your store is registered and click Edit
3. Find the radio button Postcode Required and check Yes, and then click the Save button.
This will work for a Register Account and for Guest Checkout options.