How to remove unwanted fields from OpenCart 2.x checkout page

How to remove unwanted fields from OpenCart 2.x checkout page?

OpenCart 2.x checkout page asks the customers to fill up a number of details and address information during the checkout process. However, sometimes, in order to simplify the checkout process, we wish to remove some fields from the checkout page which we think are not important for us. These fields might be unnecessarily making the checkout complex and lengthy.

In this article, I will discuss how to remove unwanted fields from OpenCart2.x checkout page. I’ll use the OpenCart version 2.x to explain how can you remove such fields from the Guest and registered checkout process.

checkout options
OpenCart uses two template files to show and control the fields on checkout

As an example, I will remove the “Fax” field from the guest checkout and Register Account. You can use the same approach to remove any other field too.

The codes for input field in checkout are handled by two main OpenCart templates:

catalog/view/theme/themeXXX/template/checkout/register.tpl – for Register Account

catalog/view/theme/themeXXX/template/checkout/guest.tpl – for Guest Checkout

PS: I would suggest you to not to edit these files directly. Take a backup of the original files first by copying these files from your web server or wherever they are located and keep them with you so that you can always revert back in case of any mistake. Take another copy of these same files and perform the editing on these files, later replace them with the original files on the site after editing.

Removing the Guest checkout fields

1. We will start with editing the Guest Checkout fields. So the first step you need to follow here is to navigate to the following file directory and open the file:

catalog/view/theme/themeXXX/template/checkout/guest.tpl 

guest.tpl file
Open guest.tpl file

2. We are removing the Fax field from the guest checkout here. So, find the following lines of code in the file you have just opened:


3. Remove this code from the file or you can also just comment it to disable the code.

code in guest.tpl file
Remove or comment the code in guest.tpl file

4. Next, we need to edit the controller file to make sure this removal will not show any “Undefined index” later. So, navigate tot he following file directory and open the file to edit the controller:

catalog/controller/checkout/guest.php

5. Look for the following lines of code in the files you have just opened:

$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'];

6. Remove the codes or you can just comment them too.

codes in guest.php file
Remove or comment the codes in guest.php file

7. Save both the files and replace them with the original files on the site.

Removing Fields from Register Account form

8. To remove the Fax field, open the following file :

catalog/view/theme/themeXXX/template/checkout/register.tpl

Open register.tpl file
Open register.tpl file

9. Find and remove the following lines of code in the file you have just opened


code in register.tpl file
Remove or comment the code in register.tpl file

10. Next, we need to edit the following controller to make sure no “Undefined index” error is shown in the later part.

catalog/controller/checkout/register.php

Open register.php file
Open register.php file

11. Find the following line of code and remove it. You can also comment it instead.

register.php file
Remove or comment the code in register.php file

12. Save both the files now, and replace them with original files on the site.

So, this is how you can remove a field like “Fax” from both the Guest checkout and Account Register form. You can follow the similar approach to remove any kind field from the OpenCart checkout. Just do not forget to keep the backup of the original files before you edit them.

Alternate solution

Editing the core files is not a recommended way to perform the changes on your OpenCart 2.x site. Some of us might suggest the use of vQmod or OCMOD to reduce the risk, but these methods are too complicated for the website owners with no or less technical knowledge.

As an alternate solution, you can choose to switch to our OpenCart one page checkout extension which is even compatible with OpenCart 2.x. It is a one-page checkout extension that removes the unnecessary elements from OpenCart 2.x and has loads of features to make your checkout conversion friendly.

How does OpenCart one page checkout plugin work?

The one page checkout extension for OpenCart replace multi-step checkout option with a single-page checkout. Without getting you into the fuzzy the code changes it incorporates all the features that an optimized checkout page is expected to have. All you need to do is to install the OpenCart v2.x one page checkout module in your store. The configuration changes are done at a few button clicks from the back-end and the changes will be reflected in the front-end of your site.

Listed below are some of the ways in which the OpenCart single page checkout can help you remove unwanted elements:

Squeezes everything on one page

Instead of going with multiple checkout steps, the OpenCart one page checkout extension squeezes all the processes in a single page. With the reduction in the number of web pages, the code of the site becomes simpler.

One-page checkout settings

No-code customization

You can “Hide” or “Display” any of the fields from the checkout page by simply changing the settings from the extension’s back end configuration. Plus you can change the orders of fields by just dragging and dropping. Along with this, the OpenCart one page checkout module for version 2.x and 1.x offers an additional comment section that can be removed at a button click if required.

Most of the store owners do not have the technical knowledge to code and make field configurations. This Opencart module brings great ease to them in setting up the checkout page layout as they require for their site. The number of fields and their position over checkout page is fully customizable from the back-office.

Guest checkout option

Without making any code changes, the OpenCart one page checkout module for v2.x enables the guest checkout option on the site. Not just this, you need not make any code changes as mentioned-above if want to remove the guest checkout at any point. This can be done just toggling a single button from the back-end of the OpenCart single page checkout plugin.

You can even register those customers who do guest checkout at your store. Additionally, you can allow your customers to set their own password while performing guest checkout.

Social login option

You need not integrate the social signup options via coding. The OpenCart one page checkout plugin comes with built-in social login options. You get Facebook and Google login options. All you need to do is to obtain the API details and share it in the back-end of the OpenCart plugin.

Multi-lingual support

If the site contents are displayed in multiple languages for different locations, then, some extra coding is required to be done. The OpenCart one page checkout extension eases out this aspect for you. The extension offers multi-lingual support and the admin can upload the contents of the sites in as many languages as they wish. The respective contents are uploaded in one go without getting you indulged in any site changes.

Set Default Options

Most of the websites provide customers with the default option as “Login” considering that the user already has their account on the store. Likewise, you can also mark default options out from “Register”, “Login” or “Guest”.

Customizable Fields

The fields provided to the customer on shipping and payment page are fully customizable from the backend panel.

Concluding Words

In the customer-centric environment, the flawless user experience is the key to stay ahead of the competition. One of the ways to do so is to keep everything precise and as combat as possible. This when a single step checkout process can help you out without getting you into the complication of code optimization.

Related Stories:

Joe Parker

We boast of the best in the industry plugins for eCommerce systems and has years of experience working with eCommerce websites. We provide best plugins for platforms like - Magento, Prestashop, OpenCart and Shopify . We also provide custom module development and customization services for the website and modules..

One thought on “How to remove unwanted fields from OpenCart 2.x checkout page?

Leave a Reply

Your email address will not be published. Required fields are marked *