Search by

hryvinskyi / magento2-privacy-consent-gdpr

hryvinskyi

Consent journal records as a data-subject entity: exported, anonymised and deleted with the shopper's other personal data.

Package info

github.com/hryvinskyi/magento2-privacy-consent-gdpr

Type:magento2-module

pkg:composer/hryvinskyi/magento2-privacy-consent-gdpr

Statistics

Installs: 1

Dependents: 0

Suggesters: 1

Stars: 0

Open Issues: 0

1.0.0 2026-11-30 18:52 UTC

This package is auto-updated.

Last update: 2026-11-30 20:07:48 UTC


README

The bridge between the privacy consent suite and the data-subject rights suite (hryvinskyi/magento2-gdpr). It makes the records of the consent journal a kind of personal data that a GDPR request handles: a copy of a shopper's consent records goes into their export, and an erasure request anonymises or deletes them with the shopper's other data. Neither suite names the other; only this package knows both. It works in the backend only: it has no storefront page.

What it does for a store

  • A new kind of data, privacy_consent. It appears in the GDPR admin's erasure rules and in every request, under the label Privacy consents, with sort order 700 (the wishlist's too; before the addresses at 900 and the account at 1000). Its default method is anonymise. It can also be deleted, and it cannot be anonymised by age: no age-based clean-up reaches it.

  • Export. The archive of a subject holds one section, privacy_consent, with one record for each journal row, oldest first. A subject with no row gets no section. The columns are:

    Column Holds
    consent_code The consent's code when the row was written.
    consent_title The consent's current title, or its code for an imported row.
    version The version number, or imported.
    action given or withdrawn.
    form The form or withdrawal path that wrote the row.
    store The code of the store view, empty once it was deleted.
    created_at When the row was written, in UTC, as an ISO 8601 date.
    reference The order's increment id or the review's id, when the row has one.
    email The subject's e-mail address held in the row.
    ip The client address as the store view's mode kept it.
    unverified Yes or No: whether an import marked the row unverified.
  • Anonymise. The kind declares two fields, email and ip, both on by default. A request replaces only the fields its instruction includes, each with the instruction's replacement for that field and row (an e-mail address becomes <20 hexadecimal characters>@anonymised.invalid, a client address becomes 0.0.0.0 or ::), and sets anonymised_at on the row. The replacement of a row is the same on every run of the request, so a second run changes nothing. The row stays: it is still the evidence that a consent was given or withdrawn, without the person.

  • Delete. With the method delete, each row is deleted by its id. A row that is already gone counts nothing and does not stop the run.

  • Which rows belong to a subject.

    • A customer covers the rows of its customer id, in every store view, whichever website the customer belongs to.
    • A guest covers the rows of its e-mail address that name no customer, in the store views of its website, and the rows whose store view was deleted (the GDPR family treats those as every website's).
    • A guest never reaches a customer's rows that carry the same address, and a row of another website's store view is left alone.
  • The customer id is left to the account. The anonymiser never clears it. When the customer account is erased, the database sets the id on the row to null.

  • No transaction of its own. The GDPR request owns the transaction, and this package's deletion and anonymisation run inside it.

Requirements

  • Magento Open Source or Adobe Commerce 2.4.x. The suite is built and tested on 2.4.9.
  • PHP 8.3 to 8.5, as the GDPR family.
  • hryvinskyi/magento2-privacy-consent-api ^1.0, hryvinskyi/magento2-privacy-consent ^1.0, hryvinskyi/magento2-gdpr-api ^1.0 and hryvinskyi/magento2-gdpr ^1.0.
  • The platform's Store module.

Installation

Run from the Magento root. The privacy consent pack lists this package as a suggestion.

composer require hryvinskyi/magento2-privacy-consent-gdpr
bin/magento module:enable Hryvinskyi_PrivacyConsentApi Hryvinskyi_Clock Hryvinskyi_ClientAddress Hryvinskyi_PrivacyConsent Hryvinskyi_GdprApi Hryvinskyi_RateLimit Hryvinskyi_DocumentExport Hryvinskyi_Logger Hryvinskyi_Gdpr Hryvinskyi_PrivacyConsentGdpr
bin/magento setup:upgrade
bin/magento setup:di:compile  # production mode only
bin/magento cache:flush

Verify with a dry run, which changes nothing and lists each kind of data with its record count:

bin/magento gdpr:export --customer-id=<customer_id> --dry-run

Replace <customer_id> with the id of a customer who has a journal record. The list holds privacy_consent.

Configuration

None of its own. The method and the fields of the kind are set with the other erasure rules (hryvinskyi_gdpr/erasure/rules, or the GDPR admin screen), under the entity code privacy_consent:

{"privacy_consent": {"method": "anonymise", "fields": ["email", "ip"]}}

A field other than email and ip is not one the kind describes, and the GDPR engine ignores it. The GDPR package's README describes the rules, the delay, the formats and the e-mails.

Limits

  • No automatic clean-up by age. The kind has no aged-record anonymiser, so the retention setting of the GDPR package does nothing for it. A consent record is kept until a request for its subject anonymises or deletes it.
  • An erasure that deletes the rows destroys the evidence. The default method anonymises and keeps each row without the person. Choose delete only where the law requires it.
  • A guest's anonymised rows no longer match the address. Their e-mail is replaced, so a later request for the same address finds nothing to export or delete.
  • Imported rows are covered. A row imported from an external journal is exported, anonymised and deleted like any other.
  • The package registers no storefront page. The customer's own consents are shown by hryvinskyi/magento2-privacy-consent-frontend, or by hryvinskyi/magento2-privacy-consent-gdpr-frontend on the GDPR Privacy Settings page.

Registrations

Where What
Entity provider A virtual type Hryvinskyi\PrivacyConsentGdpr\Model\Provider\PrivacyConsentProvider of Hryvinskyi\Gdpr\Model\Entity\EntityProvider, with a description, an exporter, a deleter and an anonymiser, and no aged-record anonymiser.
Pool Item privacy_consent in Hryvinskyi\Gdpr\Model\Entity\EntityProviderPool, argument providers, in the global etc/di.xml: an area file that names this argument would replace the list.

The package registers no table, route, command, ACL resource, cron job, event or layout.

Extension points

None of its own.

Tests

Run from the Magento root.

  • Unit: vendor/bin/phpunit -c app/code/Hryvinskyi/PrivacyConsentGdpr/phpunit.xml.dist.
  • Integration: the platform's harness in dev/tests/integration, against its own database, one run at a time. cd dev/tests/integration && php -d memory_limit=4G ../../../vendor/bin/phpunit -c phpunit.xml ../../../app/code/Hryvinskyi/PrivacyConsentGdpr/Test/Integration.
  • Static analysis: PHPStan 2.x at level 10 with the package's phpstan.neon.dist (phpstan analyse -c app/code/Hryvinskyi/PrivacyConsentGdpr/phpstan.neon.dist --level=10), and vendor/bin/phpcs --standard=app/code/Hryvinskyi/PrivacyConsentGdpr/phpcs.xml.dist app/code/Hryvinskyi/PrivacyConsentGdpr.

Translations

The wording ships in en_US and 25 more locales: the official languages of the European Union, Norwegian Bokmål and Ukrainian. The translations are machine-made; have them read by a native speaker before a store relies on them.