Knowledgebase

How to remove the "Company" field from the registration form and from the customer account settings in PrestaShop

In this article we'll show you how to hide the Company field from being displayed on the registration page and in the address form of the account settings of registered customers. By default, the company field is an optional one so customers are not required to configure it but if you want to, you can easily remove it. The process is pretty much the same for the different PrestaShop versions but for the sake of clarity we'll divide the article into two sections corresponding to the different versions:

PrestaShop 1.4

In the backend of PrestaShop 1.4 there are actually settings for editing the address form for the different countries. This in theory allows you to remove the company field from the registration page and from the address form of user account settings. To access and change these settings go to Shipping tab>Countries sub-tab, on the page that opens you'll see a table with all the enabled and disabled countries. Click on the edit button (a small pencil) of the country for which you want to edit the address form. On the page with the settings there's a text area labeled Address format; just delete company and click on the Save button.

However, this may not produce the desired result (at least for countries other than the default shop country). In addition to this if you have to modify the address formats of many or all countries, this will be too time-consuming.

Another way to do it is to modify a couple of files. This will definitely remove the Company field and it will work for all countries. One file is for the registration page and the other is for the address form of the user account settings.

To hide the company field on the registration form you need to modify the authentication.tpl file of your theme. Assuming that you use the default theme that comes prepackaged with PrestaShop and that the application is installed directly in the public_html folder on your PrestaShop hosting account, the path to the file will be public_html/themes/prestashop/authentication.tpl. In that file find the following code (around line 387):

<p class="text">
<label for="company">{l s='Company'}</label>
<input type="text" class="text" id="company" name="company" 
value="{if isset($smarty.post.company)}{$smarty.post.company}{/if}" />
</p>

It's toward the end of the file. Note that there's a similar string of code around the middle of the file but it's not the code that you need to edit.

Comment out the above code. To do this put an exclamation mark and two hyphens after the first bracket (e.g. <!--p class) and two hyphens before the last one (e.g. /p-->). You can edit the file from the Files section of the Pixie control panel. Another way to do it is to download it to your local computer with an FTP client (e.g. FileZilla), edit it with a text editor (e.g. Notepad, Wordpad) and upload it back on your hosting account overwriting the old file.

As you know registered customers can update their addresses and add new ones from their account settings. The above change will not remove the Company field from the address form of the account settings. To remove it from that form you need to edit the address.tpl file of the theme that you use. If, for example, you use the default PrestaShop theme and the root PrestaShop directory on your hosting account is public_html, then the path to the file will be public_html/themes/prestashop/address.tpl. In that file find and comment out the following code (around line 144):

<p class="text">
<label for="company">{l s='Company'}</label>
<input type="text" id="company" name="company" value="{if isset($smarty.post.company)}
{$smarty.post.company}{else}{if isset($address->company)}
{$address->company|escape:'htmlall':'UTF-8'}{/if}{/if}" />
</p>

Don't forget that when you edit template files in order to be able to see the result on the frontend you need to enable the force compile. You can do that from the admin panel from Preferences>Performance. After that refresh the frontend of your site to see the results. When you're done disable the force compile.

PrestaShop 1.5 and newer versions

Unlike previous versions, since the release of PrestaShop 1.5 you can choose whether people who want to register have to provide an address during the registration process itself. You can configure this from the admin panel. When you go to Preferences>Customers you can select from the Registration process type drop-down menu either Only account creation or Standard (account creation and address creation). So if you want to, you can exclude the address form altogether (the company field is part of the address form) from the registration page.

Like previous versions PrestaShop 1.5 also has options for editing the address format for the different countries. To do this, in the admin panel go to Localization>Countries, on the page that opens click on the edit button (a pencil) for the particular country and on the page with the settings there's a text area called Address format from which you can delete (or add again) fields. As with the previous versions, however, this may not produce the desired results for countries other than the default shop country. And it will take a lot of time if you want to edit many countries.

By modifying a couple of template files you can completely remove the company field from the registration page and from the address form of the customer account settings. This will affect the address format of all countries.

In case the registration page includes an address form (meaning you've set the Registration process type option to Standard) and you want to hide the Company field, you can do that by modifying the code of the authentication.tpl file of your theme. You need to comment out some code. The code itself might be slightly different depending on the theme. In this article we'll give examples with the default theme that comes prepackaged with PrestaShop 1.5 and the one that comes with PrestaShop 1.6. The exact code in the default themes might differ not only between major versions, but also between releases within a version. For example, the code in PrestaShop 1.5.3 may be different than that in PrestaShop 1.5.6. The line numbers that we have given may also differ depending on the version.

So if you use the default theme that comes prepackaged with PrestaShop 1.5 and the application is installed directly in the public_html directory on your PrestaShop hosting account, then the path to the file will be public_html/themes/default/authentication.tpl. In the file comment out the following code (around line 472):

<p class="text">
<label for="company">{l s='Company'}</label>
<input type="text" class="text" id="company" name="company" 
value="{if isset($smarty.post.company)}{$smarty.post.company}{/if}" />
</p>

In PrestaShop 1.6 the default theme's folder is default-bootstrap, so the path to the authentication.tpl file would be public_html/themes/default-bootstrap/authentication.tpl. The code that you need to comment out is almost exactly the same (around line 533):

<p class="form-group">
<label for="company">{l s='Company'}</label>
<input type="text" class="form-control" id="company" name="company" 
value="{if isset($smarty.post.company)}{$smarty.post.company}{/if}" />
</p>

To comment it out put an exclamation mark and two hyphens after the first bracket (e.g. <!--p class) and two hyphens before the last one (e.g. /p-->). You can edit the file from the Files section of the Pixie control panel. Alternatively, you can download the file with an FTP client, edit it on your local computer with a text editor (e.g. Notepad, Wordpad) and upload it back replacing the old file.

To remove the Company field from the address form of the account settings of registered customers you need to edit the address.tpl file of your theme.

If you use the default PrestaShop 1.5 theme and public_html is the root PrestaShop directory on your hosting account, the path to the file will be public_html/themes/default/address.tpl. In the file comment out the code (around line 103):

<p class="text">
<input type="hidden" name="token" value="{$token}" />
<label for="company">{l s='Company'}</label>
<input type="text" id="company" name="company" 
value="{if isset($smarty.post.company)}{$smarty.post.company}
{else}{if isset($address->company)}{$address->company}{/if}{/if}" />
</p>

In the address.tpl file of the default PrestaShop 1.6 theme the code looks like this (around line 52):

<div class="form-group">
<label for="company">{l s='Company'}</label>
<input class="form-control validate" 
data-validate="{$address_validation.$field_name.validate}" 
type="text" id="company" name="company" 
value="{if isset($smarty.post.company)}{$smarty.post.company}{else}
{if isset($address->company)}{$address->company|escape:'html':'UTF-8'}{/if}{/if}" />
</div>

Then you can check the results on the frontend. Note that changes to the files of a theme will be overwritten when that theme is upgraded. In the case with the default prepackaged theme this will happen when you upgrade the application; to avoid this you can create a subtheme and make that theme the default one. For more information on how to do this check out the article on creating a subtheme in PrestaShop.

Note that in PrestaShop there's an option for enabling business-to-business mode (Preferences menu>Customers sub-menu). If it's enabled, additional company information, including a field for a company name, will be added to the address form on the registration page and to the personal information section of the account settings of registered customers. The above code modifications will not affect the Company field of those additional business-to-business options.

Here are some other articles on removing fields from the registration page and the address form of customer account settings:

Was this answer helpful?

 Print this Article

Also Read