1. What this module does
Add your own fields, files and conditions to the customer registration form. PrestaShop only lets you switch its own fields on and off, but many shops — B2B shops above all — need more when a customer signs up: a company type, a VAT or licence number, a phone number, an extra consent, a document. This module adds your own fields to the Create an account page and to the Personal information step of the checkout.
You choose the type of each field — text, long text, drop-down list, radio buttons, checkbox, date or file — and whether it is required. A text can be checked as a phone number, a number or against your own pattern. Labels, hints and choices are written in every language of your shop. A field can be shown only when the customer has answered another field in a given way, and only for chosen customer groups, for example only for guests who order without an account.
The answers are saved with the customer's account. You see them in a Registration fields card on the customer's page in your Back Office, where you also download the uploaded files, and you can export them to a CSV file. They are deleted together with the customer.
Works with PrestaShop 1.7.8, 8.x and 9.x (PHP 7.2.5 or newer), with the Classic and Hummingbird themes and with multistore.
2. Installation
- Download the module from My account → Order history at addonspresta.com.
- In your Back Office, open Modules → Module Manager and click Upload a module.
- Drop the
ap_registrationfields_v1.0.0.zipfile and wait for the confirmation. - Click Configure on the module card.
If you have shell access, you can also unpack the zip into modules/ and run
php bin/console prestashop:module install ap_registrationfields from the shop folder.
The installation adds no field: the forms of your shop do not change until you create your first field. Both places — the registration page and the checkout — are switched on.
Server requirements for file fields
File fields need two things on the server. When one is missing, the module hides every file field from customers and the Fields section of the configuration page shows a warning:
- the PHP extension fileinfo, which the module uses to check the content of each file ("The PHP extension fileinfo is not enabled…" — ask your host to enable it);
- the folder
var/ap_registrationfields/of your shop, created at installation, writable by the web server ("The folder var/ap_registrationfields cannot be written…" — give PHP the right to write in it).
The files are stored in that folder under random names of 64 characters, without an extension, and are never executed.
The folder contains a .htaccess file that blocks direct access on Apache. If your shop runs on nginx, that file is
ignored: add this rule to the server block of your shop (or ask your host to add it), so that nobody can open the files
directly:
location ^~ /var/ap_registrationfields/ { deny all; }
Getting ready
- Customer groups. Open Shop Parameters → Customer Settings → Groups. At the bottom of the page, Default groups options shows the group of a new account (Customers group, usually "Customer") and the group of a guest (Guests group, usually "Guest"). These are the groups the module works with — see "Customer groups" in section 3.
- Guest checkout. In Shop Parameters → Order Settings, Enable guest checkout decides whether customers can order without creating an account.
- A page to link (optional). For a consent checkbox, prepare the page with your terms in Design → Pages.
- The fields. Open Modules → Module Manager → Custom Registration Fields → Configure and add your fields (section 4).
- A test. Open your shop in a private window, go to Create an account and check that the fields appear, then place a test order as a guest.
3. How it works
Where the fields appear
- The registration page (Create an account), when On the registration form is on in the settings.
- The Personal information step of the checkout, when In the checkout is on. There the customer can order as a guest, or create an account by typing a password.
The fields come after PrestaShop's own fields, in the order of your list. They are drawn by your theme with its own form template, so they look like the other fields of the form. A field is offered when it is active, assigned to the shop (in multistore) and allowed for the customer's group.
The fields never appear on Your personal information in the customer's account: the answers are given once, at registration, and the customer cannot see or change them later. A customer who is already logged in does not see the fields either. A guest who comes back to the Personal information step of the checkout finds his answers already filled in.
Customer groups
What counts is the group of the account that will be created:
- on the registration page: always the Customers group of Shop Parameters → Customer Settings → Groups;
- in the checkout, when guest checkout is enabled: the Guests group while the password field is empty, and the Customers group as soon as the customer types a password. The form switches the fields at once, as the customer types;
- in the checkout, when guest checkout is disabled: the Customers group.
So a field limited to the "Guest" group is asked only to guests who order without an account, and a field limited to the "Customer" group only to customers who create one. Other groups (for example a "Wholesale" group you assign later by hand) never match a new account, so a field limited to them is never shown.
Conditions
With Shown when, a field appears only when another field is filled in, ticked or has a given choice. Put the other field earlier in the list, so that customers answer it first. When the customer changes the answer, the dependent field appears or disappears at once. A hidden field is not required and nothing typed in it is saved. When the other field is itself hidden (by its own condition, its groups, or because it is inactive), the dependent field is hidden too.
Checks when the form is sent
The server checks everything again, whatever the browser did:
- which fields apply, for the group of the account that will be created and the conditions;
- the format of each answer: "Enter a valid phone number.", "Enter a number.", "This value does not have the expected format.", "This value is too long: up to 255 characters.", "Enter a valid date.", "Choose one of the listed values.";
- each file: its type ("This type of file is not accepted. Accepted files: PDF, JPG."), its size ("The file is too large: up to 2 MB.") and whether the upload worked ("The file could not be uploaded. Try again.").
A required field left empty gets PrestaShop's own "Required field" message, like the native fields. The messages are shown under the field, in the customer's language, and the account is not created until everything is right.
Files
A file field shows the accepted types and the size limit under the field, for example "Accepted files: PDF, JPG, PNG, up to 2 MB." The module reads the content of the file, not only its name: a file whose content does not match its extension is refused. Web pages, images in SVG format and scripts are never accepted.
The file is saved in the folder var/ap_registrationfields/ of your shop under a random name without an extension. In
the Back Office it keeps its original name: on the customer's page you click the name to download it.
File fields need JavaScript in the customer's browser: the module's script prepares the form so that it can send files. Without JavaScript, file fields are ignored: the customer can still create an account, but without the file, even when the field is required. Every current browser runs JavaScript, so this concerns only visitors who switched it off. The other fields work without JavaScript; the server applies the conditions and groups when the form is sent.
Saving
The answers are saved when PrestaShop creates the account (or updates the guest account). Only the fields that applied are saved; an empty answer saves nothing. If an answer or a file cannot be saved, the account is still created and a line is written to Advanced Parameters → Logs. If the module cannot check the answers at all, the customer sees "Your answers could not be checked. Try again." and the account is not created without them.
Personal data and GDPR
The answers and files are personal data of your customers. The module deletes them:
- when you delete the customer in Customers → Customers — with either option of the deletion, also the one that keeps the customer in the database to prevent a new registration with the same e-mail address;
- when you delete a field (its answers and files), or remove a choice of a list (the answers that chose it);
- when you uninstall the module (everything).
With PrestaShop's official GDPR module (psgdpr), the customer's personal data export lists each answer with its label (files by their original name), and an erasure deletes the answers and files of the customer — of every account with that e-mail address when the request is made by e-mail.
The module sets no cookie, stores nothing in the visitor's browser and makes no outgoing connection (no licence check, no statistics, nothing to addonspresta.com or any other server). If the module fails on a page, that page works without the module's part and one line per page view is written to Advanced Parameters → Logs, starting with "Custom Registration Fields:".
4. Features and settings
Open Modules → Module Manager → Custom Registration Fields → Configure. The Help box at the top links this manual and the module page at addonspresta.com in the language of your Back Office, gives our support address and shows the installed version. Below it, three links open the sections Fields, Settings and Export.
Fields
The list of your fields in the order customers see them: position, Label, Type, Required, Shown when, Customer groups, Shops (in multistore), Active and Answers (how many customers answered). Use Move up and Move down to change the order, Edit to change a field and Delete to remove it. Add a field opens an empty form; you can have up to 100 fields.
Delete removes the field together with every customer's answer and uploaded file (your browser asks you to confirm). A field that other fields depend on cannot be deleted: its row says "Other fields depend on it"; change their Shown when first.
The field form
Only the options of the chosen type are shown. Save stores the field ("Field saved."), Cancel goes back to the list. When something is wrong, nothing is saved and the reasons are listed above the form.
Type
- Text — one line, up to 255 characters.
- Long text — several lines, up to 5,000 characters, for example a short description of the business.
- Drop-down list and Radio buttons — one answer among your choices.
- Checkbox — a box to tick, for example a consent.
- Date — a date picker; the answer is saved as
YYYY-MM-DD. - File — a document or an image uploaded by the customer.
Once customers have answered a field, its type cannot change ("Customers have already filled in this field, so its type cannot change."); create a new field instead.
Active
"Show this field to customers". Switch it off to hide a field without deleting it or its answers.
Label and Hint
The Label is the name of the field in the form; for a checkbox it is the text next to the box, for example "I accept
the terms of the loyalty programme." It is required in the shop's default language, up to 255 characters. The Hint is
an optional text shown below the field, up to 500 characters. Both are typed per language; a language left empty uses
the text of the default language. They are plain text: HTML is not allowed and the characters < and > are refused.
Required
"The customer must fill in this field (tick the box, for a checkbox)". A required field that is hidden by its condition or its customer groups is not required.
Check (Text)
- Any text — no check.
- Phone number — an optional
+at the start, then digits, spaces and the characters( ) . / -, at least 5 digits; for example+48 12 345 67 89or(022) 555-0101. The field also opens the phone keypad on mobiles. - Number — digits, with an optional minus sign and one decimal part after a dot or a comma:
42,-3.5,12,75. Thousands separators are not accepted. - Pattern (regular expression) — your own rule, typed in Pattern.
Pattern
A regular expression without delimiters (no / around it), up to 255 characters. The whole answer must match it,
so you do not need ^ and $. It is case-sensitive. Examples:
[A-Z]{2}[0-9]{6}— two capital letters and six digits, for exampleAB123456;[0-9]{10}— exactly ten digits, for example a tax number;[0-9]{2}-[0-9]{3}— a postal code like31-042;[A-Za-z0-9]{5,12}— 5 to 12 letters or digits;(PL)?[0-9]{10}— ten digits, optionally preceded byPL.
A pattern that is not a valid regular expression is refused when you save the field ("The pattern is not a valid regular expression…"). Customers whose answer does not match see "This value does not have the expected format.", so explain the expected format in the Hint.
Maximum length (Text and Long text)
In characters: 1 to 255 for a text (255 by default), 1 to 5,000 for a long text (1,000 by default).
Choices (Drop-down list and Radio buttons)
One row per choice, with its label in every language and its Position (the order of the choices). Fill in the empty rows to add choices; save to get more empty rows. A list has 1 to 50 choices, each typed at least in the shop's default language. Remove deletes a choice when you save — and removes it from the answers of the customers who chose it. A choice that another field uses as its condition cannot be removed until you change that field.
Linked page (Checkbox)
A page of Design → Pages. A link to it, with the page title, is shown under the checkbox, after the hint, and opens in a new tab — for example the terms the customer accepts. None shows no link. Only active pages are offered.
Accepted files and Largest file (File)
Tick the types the customer may upload: PDF, JPG (also .jpeg), PNG, GIF, WEBP, DOC, DOCX, XLS, XLSX, ODT, ODS, TXT and
CSV. PDF, JPG and PNG are ticked for a new field. Largest file (MB) is 2 MB by default; the highest value is 20 MB,
or less when your server accepts smaller uploads — the form says "Up to … MB on your server." A file field cannot be used
as the condition of another field.
Shown when
"Always", or a condition on another field: "«Field» is filled in", "«Field» is ticked" (for a checkbox) or "«Field» is «choice»" (one choice of a list or radio buttons). For example, show a "VAT number" field only when "Company type" is "Company". A field cannot depend on itself, on a file field or on a field that depends on it ("This condition is not possible…"). A field that others depend on cannot become a file field.
Customer groups
All groups, or switch it off and tick the groups that will see the field ("Choose at least one customer group, or All groups."). The group that counts is the group of the new account: Guest for an order without a password, the default customer group for a new account (section 3).
Shops (multistore only)
The shops whose forms show the field — at least one of the shops you manage. See section 5.
Settings
Saved for the shop or shop group selected in the Back Office header with Save ("Settings saved."):
- On the registration form — the fields on the Create an account page. On after the installation.
- In the checkout — the fields in the Personal information step, for guests and for customers who create an account while ordering. On after the installation.
Switch a place off to keep the fields only in the other one. Each field still follows its groups and conditions.
Export
Download CSV downloads registration-fields-<date>.csv: one row per customer of the shops selected in the header
who answered at least one field. The columns are id_customer, shop, firstname, lastname, email, account
(customer or guest), group (default group), registered (date of the account), then one column per field, with
its label in your language. Lists and radio buttons give the label of the choice ("(removed choice)" when it was
removed), checkboxes "Yes" or "No", dates YYYY-MM-DD and files their original name. The file is in UTF-8 with
semicolons, so Excel and LibreOffice open it directly; a cell that starts with =, +, - or @ gets an apostrophe in
front so that it is never run as a formula. Deleted customers are not exported.
The export needs the right to view customers (Advanced Parameters → Team → Permissions, Customers); without it the section says "You need the right to view customers to export their answers."
The customer's page
Open Customers → Customers and view a customer. When the customer answered at least one field, the card Registration fields lists each label with the answer; a long text keeps its line breaks. For a file you see its original name and size: click the name to download the file. The link is shown only to employees who may view customers.
The card is shown to employees whose profile has the module's View permission (Advanced Parameters → Team → Permissions, Modules) and who manage the customer's shop. The answers cannot be edited in the Back Office.
5. Multistore
Fields are shared: one field can be used by several shops, ticked under Shops in the field form. The list shows the fields of every shop you manage, whatever is selected in the header, so you see each field once. A field that is also used in a shop you do not manage is read-only for you ("Also used in shops you do not manage"); an employee who manages all its shops can change it. The Answers column counts the customers of your shops.
Settings are saved for the shop or shop group selected in the Back Office header; values saved with All shops apply to every shop that has no value of its own. In the All shops or a group context only an employee who manages every shop of that context can save ("Select one of your shops in the header to change the settings…").
The Export contains the customers of the shops selected in the header that you manage. The customer card is shown only for customers of the shops you manage. Each storefront shows only the fields assigned to its shop, with the settings of that shop. Deleting a shop removes it from the fields. One licence covers every shop of the installation.
6. Uninstall
Module Manager → Custom Registration Fields → Uninstall deletes everything the module created, in every shop: your fields, all the answers of your customers and every uploaded file, and the settings. It cannot be undone: download the CSV export first if you want to keep the answers, and the files you need from the customers' pages. Reset does the same and then installs the module again without any field. Your customers and their accounts are not touched.
Disable keeps the fields, the answers and the files. While the module is disabled, the forms show no extra field and the customer card is not shown; enabling the module brings everything back.
7. FAQ and troubleshooting
A field does not appear in the form. Check that the field is Active, assigned to this shop (multistore), that its place is on in Settings, and that its Customer groups include the group of the account that will be created: on the registration page only the Customers group of Shop Parameters → Customer Settings → Groups counts. Check its Shown when: the other field must be answered first, and must itself be visible. You must not be logged in as a customer. A file field also needs the server requirements of section 2. Clear the cache in Advanced Parameters → Performance after changing your theme.
I limited a field to my "Wholesale" group, and nobody sees it. A new account is always created in the default customer group (or Guest for a guest order); groups you assign later by hand are not known at registration. Use All groups, or the "Customer" or "Guest" group.
The configuration page warns that file fields are not shown.
The PHP extension fileinfo is missing, or the folder var/ap_registrationfields/ cannot be written by the web server.
Ask your host to enable fileinfo, or to make the folder writable. The other fields keep working.
My shop runs on nginx. Are the files safe?
The files have random names of 64 characters and no extension, are never shown, logged or exported, and are never
executed. The .htaccess protection of the folder only works on Apache, so add the nginx rule of section 2 to close
direct access completely.
A customer registered without the required file. The customer's browser ran without JavaScript, so the file could not be sent; file fields are then ignored so that the customer can still register. Ask the customer to send the document by e-mail, or check it before you validate the account.
Can a customer change his answers after registration? No. The fields are asked only at registration and in the checkout, never on Your personal information. A guest who comes back to the Personal information step of the checkout can change them.
Can I add fields to addresses or to orders? No, the module adds fields to the customer account only.
Can I put a link or bold text in a label?
No, labels, hints and choices are plain text (< and > are refused). For a link to your terms, use a Checkbox with
a Linked page.
Can I change an answer in the Back Office? No, the answers are shown and exported as the customer gave them.
Can robots fill my server with files? PrestaShop's registration form has no captcha of its own. Keep Largest file (MB) as small as your documents need and protect the forms with a captcha module.
"The page has expired. Reload it and save again." The page was open for a long time, or you logged in again in another tab. Reload the page and save again.
A text of the module is still in English in my shop or Back Office. Open International → Translations → Installed modules translations, select the module and your language, and check the translation. Labels, hints and choices are typed per language in the field form.
8. Updates and support
Updates are free for life: download new versions from My account → Order history at addonspresta.com and upload them like a new module. Your fields, settings, answers and files are kept.
Support is included for 12 months from your order: write to mail@addonspresta.com or use the contact form at addonspresta.com (Monday to Friday, 10:00–16:00; we usually answer within 2 business days). Please include your PrestaShop version, the module version and the steps that lead to the problem.