=== Digital Product Passport === Contributors: pluginwave Tags: digital product passport, json, woocommerce Requires at least: 5.8 Tested up to: 6.8 Requires PHP: 7.2 Stable tag: 0.1.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Lightweight, vendor-agnostic Digital Product Passport viewer for WordPress and WooCommerce. Renders DPP JSON as accessible HTML and JSON tabs. == Description == This plugin exists to solve a simple but common need: display a Digital Product Passport (DPP) on WordPress sites, including WooCommerce product pages, without being tied to a specific provider or API. If you have the JSON, this plugin will render it consistently, accessibly, and without sending data to third parties. Key features - Vendor-agnostic: Works with any DPP JSON source. No provider lock-in. - WooCommerce ready: Adds a meta box on product edit screens to store the JSON. - Human-readable HTML view: Clean accordion layout with friendly labels (for example, "End of Life and Circularity"), tuned for Ecodesign for Sustainable Products Regulation (ESPR) naming styles. - JSON view: Inspect the raw JSON in a formatted code block; one-click Copy JSON. - Shortcode and Block: Insert the viewer with a shortcode or the included Gutenberg block. - Classic Editor button: "Insert Digital Product Passport" modal for quick shortcode setup. - Accessibility: Keyboard navigation, ARIA roles, semantic HTML (details/summary). - Responsive: Looks great on phones, tablets, and desktops. - Privacy by design: No tracking, no external calls, no cookies. - Translation ready: All strings can be localized. Why this plugin - One viewer for WordPress and WooCommerce that is independent of provider. - Displays your DPP from post/product meta in a consistent way across themes. - Uses only the JSON you supply and renders it locally in the browser. == Installation == 1. Upload the `digital-product-passport` folder to the `/wp-content/plugins/` directory. 2. Activate the plugin through the "Plugins" menu in WordPress. 3. Paste (or save) JSON in the "Digital Product Passport" meta box on any post/page/product, or use the block/shortcode. = Manual ZIP installs = - From WordPress.org, the download is `digital-product-passport.zip` (latest stable). - For manual builds (e.g., GitHub release), package the plugin as `digital-product-passport-.zip` (with dots, e.g. `digital-product-passport-0.1.0.zip`). - To generate a correctly named ZIP locally, run: `composer run package` and use the artifact created in `dist/`. == Usage == - Quick start: 1. Edit any post, page, or WooCommerce product and find the "Digital Product Passport" meta box. 2. Paste valid JSON and update/publish. The plugin stores it as post meta. 3. Insert the viewer where you want it to appear using either the shortcode or the block below. - Shortcode: `[digital_product_passport]` - By default renders the JSON saved in the meta box for that post/product. - You can also pass inline JSON via the `json` attribute (single quotes recommended around the JSON): - Example: `[digital_product_passport json='{"id":"urn:uuid:123","type":"Product","name":"Sample"}']` - Attributes: - `json`: Inline JSON to render (optional). If omitted, uses the saved post meta JSON. - `view`: `html|json` to pick the default tab (default `html`). - `show_raw`: `true|false` to force JSON (deprecated; overrides `view`). - `title`: Optional title displayed above the viewer. - `limit`: Number of top-level sections to show before a Show more toggle. `0` (default) shows all. - `include`: Comma-separated list of section keys/labels to include (case-insensitive; matches raw keys or humanized labels). Example: `include="id,type,manufacturer"`. - `exclude`: Comma-separated list of section keys/labels to hide. Example: `exclude="identifiers,documentation"`. - `order`: Comma-separated preferred order of sections. Items not listed keep their natural order after these. Example: `order="id,type,manufacturers,identifiers"`. - `more_label` / `less_label`: Override the Show more/Show less button text. - Examples: - `[digital_product_passport view="html" title="Digital Product Passport"]` - `[digital_product_passport view="json"]` - `[digital_product_passport limit="5" order="ID,Type,Manufacturers" exclude="Documentation"]` - `[digital_product_passport include="ID,Version,Language,Identifiers" more_label="Show all details" less_label="Show fewer"]` - Note: The legacy `[dpp]` shortcode has been removed to comply with wp.org prefixing guidelines. Use `[digital_product_passport]`. - Block (Gutenberg): "Digital Product Passport" - Add the block and (optionally) paste JSON in the block settings to override the post/product meta for that block. - Choose the default tab (HTML or JSON) in the block inspector. - Classic Editor: Use the "Digital Product Passport" toolbar button - Click the button, pick a title and default view (HTML or JSON), then insert. It uses the JSON saved in the meta box. - WooCommerce: On product edit screens, the same meta box is available. Place the `[digital_product_passport]` shortcode in any product description area or block to display the viewer on the product page. - Viewer controls (front end): - Tabs switch between HTML and JSON. The JSON view has a "Copy JSON" button. - Large passports show a Show more/less toggle when `limit` is set. - Troubleshooting: - If you see "No Digital Product Passport JSON found.", either save valid JSON in the meta box or pass JSON via the shortcode `json` attribute. - Ensure the shortcode `[digital_product_passport]` is present where you expect the viewer to appear. == Compliance and Privacy == - Privacy by design: No tracking, no external calls, no cookies. - Data handling: DPP JSON is stored as post meta and rendered client-side. Nothing is sent to third parties. - Security: Output is escaped and JSON is normalized server-side before embedding. - Accessibility: Semantic HTML with ARIA, keyboard navigation, and visible focus. - Performance: Minimal CSS/JS loaded only when the viewer is present. == External services == - None required: This plugin does not connect to, depend on, or transmit data to any third‑party/external service. No data leaves your site when rendering a passport. - Example placeholders: The sample JSON shown in the editor includes illustrative links such as `https://example.com` and `https://example.com/manual.pdf`. These are placeholders for demonstration only; the plugin does not fetch or otherwise contact those URLs. Replace them with your own documentation links as needed. - Namespaces in SVG: The editor/block icon contains inline SVG markup that references the XML namespace `http://www.w3.org/2000/svg`. This is a namespace identifier, not a network request or external service. No third‑party terms of service or privacy policies apply because the plugin does not use any external services. === GDPR and EU Privacy Notes === - Personal data scope: This plugin does not collect, track, or profile users. It only renders the DPP JSON you provide. If your JSON contains personal data (for example, a contact person's name or email), you are the controller of that data. - Lawful basis: Ensure you have a lawful basis under GDPR to publish any personal data included in the DPP. Prefer business contacts or shared inboxes over named individuals where possible. - Data minimization: Avoid including personal data unless strictly necessary for the product passport. Consider using role-based contacts (e.g., support@example.com). - Data location and transfers: The plugin does not perform network requests or transfer data to third countries. Any links inside your JSON are rendered as links only; the plugin does not fetch or proxy them. - Retention: DPP JSON is stored as post meta and retained until you edit or delete the post/product or remove the meta. - Data subject rights (DSR): The plugin does not store visitor-level personal data, so it does not add custom exporters or erasers. If you include personal data in DPP JSON, handle DSRs by updating/removing the JSON in your content. - Privacy Policy helper: The plugin registers guidance for Tools > Privacy so you can include accurate information on your site's Privacy Policy page. - Redaction hooks: Developers can filter or redact fields before display using the `digital_product_passport_viewer_data` filter. - Access control: The viewer displays wherever the post/product is visible. Use WordPress visibility/roles or your membership tools to restrict access if needed. - Disclaimer: This is not legal advice. Consult your legal counsel to confirm compliance for your use case. == Frequently Asked Questions == = Does this plugin require a third-party service? = No. It is provider-independent and does not call external APIs. If you have JSON, the plugin will render it. = Does the plugin validate a specific DPP schema? = It does not enforce a particular schema. It renders any valid JSON and includes humanization for common ESPR-style keys in the HTML view. = Is WooCommerce required? = No. The plugin works with WordPress posts and pages. When WooCommerce is active, a meta box is also available on product edit screens. == Screenshots == 1. HTML view with accordion sections and friendly labels 2. JSON view with formatted code and "Copy JSON" button == Changelog == = 0.1.0 = * Initial release.