- Web templates
- E-commerce Templates
- CMS & Blog Templates
- Facebook Templates
- Website Builders
OpenCart 2.x. How to remove fields from checkout process
June 30, 2015
In this tutorial you will learn how to remove checkout fields in OpenCart.
OpenCart 2.x. How to remove fields from checkout process
By default, OpenCart requires your customers to specify some personal information and address fields while checkout. However, sometimes we might want to simplify the checkout process by removing some fields from the checkout page.
-
In this example we will show you how to remove the Fax field from Guest Checkout and Register Account.
-
There are two main templates responsible for input fields during checkout in OpenCart template(s): catalog/view/theme/themeXXX/template/checkout/register.tpl for Register Account and catalog/view/theme/themeXXX/template/checkout/guest.tpl for Guest Checkout. Both of the files follow a similar structure, so the process of modifying guest checkout template and the new user registration template will be similar:
-
Let’s start from editing Guest Checkout fields. Connect to your server using FTP client or File Manager within your hosting cpanel.
-
Open catalog/view/theme/themeXXX/template/checkout/guest.tpl file:
-
In order to remove the Fax field, find the following code:
<div class="form-group"> <label class="control-label" for="input-payment-fax"><?php echo $entry_fax; ?></label> <input type="text" name="fax" value="<?php echo $fax; ?>" placeholder="<?php echo $entry_fax; ?>" id="input-payment-fax" class="form-control" /> </div>
Remove this code or comment it out:
-
Next file which we need to edit is catalog/controller/checkout/guest.php:
-
Find the following code and remove it:
$data['entry_fax'] = $this->language->get('entry_fax'); if (isset($this->session->data['guest']['fax'])) { $data['fax'] = $this->session->data['guest']['fax']; } else { $data['fax'] = ''; }
$this->session->data['guest']['fax'] = $this->request->post['fax'];
-
Save both files and upload them to the server replacing the original files:
-
Now let’s change the Register Account fields.
-
Open catalog/view/theme/themeXXX/template/checkout/register.tpl file:
-
In order to remove the Fax field, find the following code:
<div class="form-group"> <label class="control-label" for="input-payment-fax"><?php echo $entry_fax; ?></label> <input type="text" name="fax" value="" placeholder="<?php echo $entry_fax; ?>" id="input-payment-fax" class="form-control" /> </div>
-
the next file which we need to edit is catalog/controller/checkout/register.php:
-
Find the following code and remove it:
$data['entry_fax'] = $this->language->get('entry_fax');
-
Save both files and upload them to the server replacing the original files.
Thank you for reading this tutorial. Now you know how to remove checkout fields in OpenCart template(s).
Feel free to check the detailed video tutorial below: