Opencart is best open source software for small and medium eCommerce business websites but there is some limit comes and it does not provide full control over design for example if you are selling digital downloadable good and does no require shipping address and telephone number then how you can remove. Today we provide solution to remove telephone field from OpenCart checkout and register page. Just follow steps and also must take backup first before we proceed
We need edit on server directory so access it via FTP or web browser:
- Edit the first template file to remove the actual field from the html:
catalog/view/theme/YOURTHEME/template/account/register.tpl
- Find and Remove the form field and surrounding table code. You should be able to follow the pattern of the file based on the tabbing.
<tr><td><span class=”required”>*</span> <?php echo $entry_telephone; ?></td><td><input type=”text” name=”telephone” value=”<?php echo $telephone; ?>” /><?php if ($error_telephone) { ?><span class=”error”><?php echo $error_telephone; ?></span><?php } ?></td></tr>
- Now you need to EDIT the controller file to remove the error checking:
catalog/controller/account/register.php
- FIND and REMOVE the validation code. All validation is done in the “validate” function towards the bottom. Find and remove the following:
if ((utf8_strlen($this->request->post[‘telephone’]) < 3) || (utf8_strlen($this->request->post[‘telephone’]) > 32)) {$this->error[‘telephone’] = $this->language->get(‘error_telephone’);}
That completes the necessary changes for the account/register step.
- Edit checkout/register template file:
catalog/view/theme/YOURTHEME/template/checkout/register.tpl
- Find and Remove the actual form field so no options display there:
<span class=”required”>*</span> <?php echo $entry_telephone; ?><br /><input type=”text” name=”telephone” value=”” class=”large-field” /><br /><br />
- Edit the associated controller
catalog/controller/checkout/register.php
- Find and Remove the validation check:
if ((utf8_strlen($this->request->post[‘telephone’]) < 3) || (utf8_strlen($this->request->post[‘telephone’]) > 32)) {$json[‘error’][‘telephone’] = $this->language->get(‘error_telephone’);}
That completes the necessary changes for the checkout/register step.
- To prevent warnings massage and popup open catalog/model/account/customer.php here search and remove below line
telephone = ‘” . $this->db->escape($data[‘telephone’]) . “‘,
- EDIT the checkout/guest template file:
catalog/view/theme/YOURTHEME/template/checkout/guest.tpl
- FIND and REMOVE the actual form field:
<span class=”required”>*</span> <?php echo $entry_telephone; ?><br /><input type=”text” name=”telephone” value=”<?php echo $telephone; ?>” class=”large-field” /><br /><br />

8 Comments
Leave a Reply