# Data Ownership — magento-shippingfields

> **Last verified:** 2026-02-26 (Europe/London)
> **Owner:** Engineering
> **Related:** [GDPR.md](GDPR.md) | [BOUNDARIES.md](BOUNDARIES.md)

---

## Data Ownership Summary

| Entity | System of Record | Writes Here | Reads Here | Notes |
|--------|------------------|------------|------------|-------|
| `quote.shipping_date` | This module | `ShippingFieldsManagement`, `ShippingInformationManagementPlugin` | `QuoteSubmitBefore`, `QuoteRepositoryPlugin` | Added by this module; Magento owns the table |
| `quote.shipping_message` | This module | `ShippingFieldsManagement`, `ShippingInformationManagementPlugin` | `QuoteSubmitBefore`, `QuoteRepositoryPlugin` | Added by this module; Magento owns the table |
| `sales_order.shipping_date` | This module | `QuoteSubmitBefore` observer (via order object) | `ShippingFields` block, `OrderRepositoryPlugin` | Added by this module; Magento owns the table |
| `sales_order.shipping_message` | This module | `QuoteSubmitBefore` observer (via order object) | `ShippingFields` block, `OrderRepositoryPlugin` | Added by this module; Magento owns the table |

---

## DB Schema — Added Columns

This module extends Magento-owned tables by adding columns. Schema installed via `src/Setup/InstallSchema.php` and upgraded via `src/Setup/UpgradeSchema.php`.

### Table: `quote`

| Column | Type | Nullable | Notes |
|--------|------|----------|-------|
| `shipping_date` | DATE | YES | Customer's preferred delivery date |
| `shipping_message` | varchar/text | YES | Special shipping instructions (max 255 chars) |

### Table: `sales_order`

| Column | Type | Nullable | Notes |
|--------|------|----------|-------|
| `shipping_date` | DATE | YES | Copied from quote on order submission |
| `shipping_message` | varchar/text | YES | Copied from quote on order submission (max 255 chars) |

`UNKNOWN — Requires Clarification`: Exact column type (DATE vs varchar, varchar vs text) — inferred from context; not confirmed from schema file output.

---

## PII Assessment

| Field | Category | Source | Stored Where | Transmitted To |
|-------|----------|--------|-------------|----------------|
| `shipping_date` | Non-personal (preference data) | Customer input at checkout | `quote`, `sales_order` | `portalpeople/magento-orderwebhook` (if installed) |
| `shipping_message` | Potentially personal (free text) | Customer input at checkout | `quote`, `sales_order` | `portalpeople/magento-orderwebhook` (if installed) |

**Note on `shipping_message`:** This is a free-text field. Customers may include personal information (e.g., "Leave at 23 Church Lane"). GDPR considerations apply.

---

## Data Retention

`UNKNOWN — Requires Clarification`: No data retention policy is defined within this module for `shipping_date` and `shipping_message`. They persist as long as the parent `quote` or `sales_order` row exists. Magento does not automatically archive or purge these by default.

---

## Invariants

- Fields are written to `quote` before order placement (checkout flow) and to `sales_order` via the `QuoteSubmitBefore` observer.
- A redundant write path also exists: `ShippingInformationManagementPlugin` writes to quote, and `QuoteToOrderPlugin` transfers from quote to order — overlap with the primary paths.
- Fields are surfaced to admin via `ShippingFields` block on the order view page.

---

## Confirmed Facts

- Two columns added to `quote` and two to `sales_order` via declarative schema.
- No new tables are created by this module.
- `shipping_message` is a free-text field — may contain personal data depending on customer input.

---

## Unknowns

1. `UNKNOWN — Requires Clarification`: Exact column types (DATE vs varchar for `shipping_date`; varchar vs text for `shipping_message`).
2. `UNKNOWN — Requires Clarification`: Is there a data retention policy for shipping fields on quotes and orders?
3. `UNKNOWN — Requires Clarification`: Does `shipping_message` content require GDPR consent or disclosure given its free-text nature?
4. `UNKNOWN — Requires Clarification`: Are these fields transmitted externally by any other module (e.g., `magento-orderwebhook`)? If so, cross-module GDPR scope applies.

---

## Evidence

- `/modules/magento-shippingfields/src/Setup/InstallSchema.php`
- `/modules/magento-shippingfields/src/Setup/UpgradeSchema.php`
- `/modules/magento-shippingfields/src/Model/ShippingFieldsManagement.php`
- `/modules/magento-shippingfields/src/Plugin/ShippingInformationManagementPlugin.php`
- `/modules/magento-shippingfields/src/Observer/QuoteSubmitBefore.php`
- `/modules/magento-shippingfields/src/Block/Adminhtml/Order/ShippingFields.php`
- `/modules/magento-shippingfields/src/etc/extension_attributes.xml`
