GDPR-Ready Forms in Magento 2: Consent, Retention and Erasure

How to make Magento 2 forms GDPR-ready: consent checkboxes that record what was agreed, data minimisation, retention, erasure requests and secure file uploads.

GDPR-Ready Forms in Magento 2: Consent, Retention and Erasure

Every form on your Magento 2 store collects personal data: a name, an email address, sometimes a phone number, a delivery address or a photo. If you sell to customers in the EU or the UK, the GDPR applies to that data from the moment the form is submitted until the last copy is deleted. This guide explains what a GDPR-ready form in Magento 2 looks like, what the built-in contact form does and does not do, and how to set up consent, data minimisation, retention and erasure with Custom Form Builder for Magento 2.

This article explains common practice. It is not legal advice: check your privacy policy and your lawful basis with a qualified adviser.

Short answer: a GDPR-ready Magento 2 form asks only for the data it needs, explains why, records consent when consent is your lawful basis (with the exact text the customer agreed to), keeps submissions only as long as needed, stores uploads securely, and lets you find, export and delete one person's data on request.

What the GDPR means for forms

Five GDPR principles matter most for website forms:

  • Lawful basis (Article 6): you need a reason to process the data. Answering a question the customer sent you is usually covered by their request; sending them marketing needs consent.
  • Consent you can prove (Article 7): where you rely on consent, you must be able to show what the person agreed to and when.
  • Data minimisation and storage limitation (Article 5): collect only what you need and keep it no longer than necessary.
  • Rights of access and erasure (Articles 15 and 17): people can ask what you hold about them and ask you to delete it.
  • Security (Article 32): personal data, including uploaded files, must be protected against unauthorised access.

Is Magento's built-in contact form GDPR compliant?

The default Magento 2 contact form can be used in a GDPR-compliant way, but it gives you few tools. It has no consent checkbox, and Magento Open Source stores no copy of the message: it only sends an email. That means every message lives in a mailbox, where you have to handle retention and deletion yourself. For one form and a small inbox that can be manageable. For several forms, attachments or a team sharing the work, it becomes hard to answer "what data do we hold about this person?". We compare both options in Magento's built-in contact form vs Custom Form Builder.

Custom Form Builder has a Consent field type. When a customer ticks it, the submission stores the exact consent text and its version number, and both are shown on the submission page in the admin. When you change the wording, raise the version number, so older submissions still show what those customers agreed to.

Magento 2 form with a separate unticked newsletter checkbox and a required GDPR consent checkbox above reCAPTCHA

Good practice for consent checkboxes:

  • Never pre-tick them. A pre-ticked box is not valid consent.
  • Keep purposes separate. "Answer my request" and "send me news" are two different checkboxes, and the marketing one should be optional, as in the example above.
  • Link to your privacy policy from the consent text, and say what the data is used for.

2. Collect less data

  • Remove fields you do not use. If nobody calls customers back, do not ask for a phone number.
  • Show fields only when they are relevant. Conditions show, hide or require fields depending on earlier answers, for example a Company field only for business customers. Hidden fields are not checked and their answers are not saved.
  • Email without saving. A field set to Exclude from Storage is emailed but never saved in the database.
  • Limit IP addresses. Under Stores > Configuration > Magexweb Extensions > Form Builder > Privacy, choose how the visitor's IP address is stored: Hashed (a keyed hash that still allows rate limiting but cannot be read back), Truncated, or Do not store.
Form Builder privacy settings in the Magento 2 admin: Visitor IP Address and Default Submission Retention

3. Delete submissions automatically

Decide how long each form's data is needed: a contact message may be needed for a few months, a quote request for a year. In the form's After Submit section, set Keep Submissions for (Days). Magento cron then deletes older submissions every hour, together with their uploaded files. The Default Submission Retention setting applies the same period to new forms.

After Submit settings of a Magento 2 form with Keep Submissions for Days

Remember the copies outside Magento: notification emails sit in your team's mailboxes and exported CSV files sit on laptops. Your retention policy should cover those too.

4. Answer access and erasure requests

  • Access: logged-in customers can see their own submissions in My Account > My Submissions, if you turn it on for the form. In the admin, a customer's page shows all their form submissions, and you can export submissions to CSV or Excel.
  • Erasure: one command finds every submission with an email address, as the sender or in any email answer, and deletes or anonymizes them:
CommandWhat it does
php bin/magento formbuilder:submissions:erase name@example.comShows how many submissions have that address
... --yesDeletes them, with their files
... --yes --anonymizeRemoves every answer, file and personal detail, and keeps only the fact that a submission was made

In the admin, Anonymize and Delete are also available on a single submission and as mass actions, protected by their own admin permission.

5. Protect uploaded files and limit who sees them

  • Uploaded files are stored outside the public web folder, under random names, and are only delivered to admins with the Submissions permission or to the customer who sent them.
  • Every file is checked on the server (extension, size and real content type), and script and executable types are always refused.
  • Images are re-saved, which removes hidden EXIF data such as the location where a photo was taken.
  • Files that were uploaded but never submitted are deleted after 24 hours.
  • Separate admin permissions for viewing, exporting and deleting submissions mean staff only see what their job needs.

6. Know which third parties see form data

Custom Form Builder loads no external scripts, fonts or styles, except Google reCAPTCHA when you enable it and the Google Maps JavaScript API when you set up address autocomplete. If you use either, name Google in your privacy policy and consider your cookie banner. Without reCAPTCHA, the honeypot, minimum fill-in time and per-visitor limit still stop most spam.

GDPR checklist for Magento 2 forms

  1. List every form on the store and what each one collects.
  2. Remove fields you do not need and use conditions for the rest.
  3. Write down the lawful basis and the retention period for each form.
  4. Add an unticked consent field where consent is the basis, with a link to the privacy policy.
  5. Set retention per form and make sure Magento cron runs.
  6. Choose Hashed, Truncated or Do not store for IP addresses.
  7. Restrict admin access to submissions with roles.
  8. Test an erasure request from start to finish, including mailboxes and exports.

Need the forms first? Start with 5 forms every Magento store should have, and see every privacy setting in the Custom Form Builder user guide.

Frequently asked questions

Is Magento 2 GDPR compliant out of the box?

No software makes a store compliant by itself: compliance depends on how you collect, use and keep data. Magento Open Source has some tools, such as cookie restriction mode, but its contact form has no consent field and no retention or erasure tools for messages.

Not always. Answering a question someone asked you can rely on their request rather than consent. You do need separate, optional consent for marketing, such as a newsletter checkbox.

Do I need a separate GDPR extension for forms?

A general GDPR extension usually covers customer accounts, orders and cookies. Form submissions need their own consent, retention and erasure tools. Custom Form Builder includes these for the forms it creates.

How do I delete one customer's form data in Magento 2?

With Custom Form Builder, run php bin/magento formbuilder:submissions:erase name@example.com --yes, or select their submissions in Form Builder > Submissions and use Delete or Anonymize. Then remove the matching notification emails and exports.

0 Comments

No comments yet. Be the first to comment.

Leave a Comment

Your email is never published.

Keep reading.

More guides from the Magexweb blog.

All articles

Rather we handle it?

Upgrades, security patches and platform moves are what we do every day. Tell us what your site needs, and we will reply with questions and next steps.

  • Email info@magexweb.com
  • Phone +91 99092 71288
  • Hours Mon–Fri, 10:00 AM to 8:00 PM IST
  • Office D-1002, Jasmin Green 1, Near Vaishnodevi Circle, Ahmedabad 382421, India

  • Free consultation
  • NDA available
  • Reply by email