Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Document the digital products feature as it now stands
Damian Legawiecf54f729ec43f
diff --git a/CLAUDE.md b/CLAUDE.mdindex 16d122e981..7118a5f8e9 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -27,7 +27,7 @@ Active plans (6.0 target, work pending):- `6.0-document-numbers.md` — Document number customization (**implemented 2026-08-13**): `Spree::Core::NumberGenerator` module factory → **`has_spree_number prefix: 'R'`** (macro from `Spree::HasNumber`, included into `Spree::Base` — no per-model include) + runtime `Spree.number_generators` registry (`Sequential` | `Random` strategies). **Sequential is the 6.0 default** (per-`(store, resource_type)` `spree_number_sequences` counter, `with_lock`, start 1001), random opt-in; merchant settings = one "Order numbers" card (prefix/suffix/format/start as Store preferences) — orders only. Fulfillment + Payment numbers become **derived methods** (`R1001-F1`/`R1001-P1`; stored value honored on legacy rows, columns frozen — never write them; gateway `order_id` = `payment.number`); every other numbered model keeps its stored number (Import/Export mail theirs, so they stayed numbered too), and `Spree::PurchaseOrder` must be born with `has_spree_number prefix: 'PO'`. Saving a numbered record with `validate: false` requires calling `generate_number` first. Never parse/regex a `number`; mostly-gapless, never legal invoice numbering.- `6.0-delivery-profiles.md` — **Implemented in PR #14404 (2026-08-09).** `Spree::DeliveryProfile` = ShippingCategory promoted via table rename (`spree_shipping_categories`→`spree_delivery_profiles`, `products.shipping_category_id`→`delivery_profile_id`): store-scoped STI (kinds `DeliveryProfiles::Shipping`/`::Digital` via `Spree.delivery_profile_types`), one default per store, products reference it directly and it's required (auto-assigned: type template else store default; ProductType stamps at creation only — template doctrine). Profile ↔ stock locations (origins, empty=all) + profile→zones + profile→methods; method binds ≤1 zone (m:n join dropped), optional ships-from narrowing per method (no location-group layer — considered, dropped). **Classes only, NO string vocabularies:** method `fulfillment_type` column dropped, `Spree.fulfillment_types` registry + ProductType array deleted; behavior = `FulfillmentProvider` class predicates (`digital?`/`pickup?`/`pickup_point?`/`requires_address?`), rate-provider `requires_address?`, profile kind `digital?`/`requires_shipping_address?` + composition validations. Carts split per profile (`Splitter::DeliveryProfile`); Coordinator allocates only from profile-covered locations. `spree:migrate_delivery_profiles` (5.6→6.0 manifest) does store assignment/kind detection/non-narrowing fold-in/method m:n collapse (`spree_shipping_method_categories` survives to 6.1 as source). ShippingCategory/ShippingMethodCategory classes + associations deleted. Supersedes the string-registry + "named groups 6.1" decisions.- `6.0-fulfillment-and-delivery.md` — Shipment→Fulfillment, ShippingMethod→DeliveryMethod, drop ShippingCategory, FulfillmentProvider strategy, pickup (merchant StockLocation) + pickup_point (third-party PickupPointProvider). **Shipped to 6-0-dev (Waves 2+4+6):** renames + deprecated twins, providers (Manual/Digital/Pickup/PickupPoint), dual-emit events, store pickup discovery endpoints, admin delivery_methods/delivery_zones CRUD + dashboard settings pages, FulfillmentMailer; Wave 7 shipping→delivery data migration remains. Pickup work beyond shipped code deferred to 6.1 (2026-08-06): contract hardening (`new(delivery_method)` ctor, `find_nearby` zipcode/query) + how-to guide; `PickupPointProvider::Base` stays **undocumented in 6.0** (v6 docs cover only the delivery rate provider interface) — never add pickup-provider docs in 6.0 work. Delivery mechanics live on provider classes (`pickup_point` provider ships but stays unregistered until 6.1; `local_delivery` cut = shipping + postal-code zone); the string fulfillment-type registry was deleted by `6.0-delivery-profiles.md`. **Partial fulfillment (2026-08-10, resolved question 12):** shipping a subset is `Spree::Fulfillments::Fulfill` (optional per-line-item `items:` + `tracking:` + `notify_customer:`; splits then fulfills in one transaction) — never a state-machine event, since split-then-ship in an `after_transition` is what service-workflows prohibits. **Side effects left the machine (2026-08-10, question 13):** `after_cancel`/`after_resume` are gone as transition callbacks — restock + carrier stand-down live in `Fulfillments::Cancel`/`::Resume` as inline steps (provider call is an `external_step`; `notify_provider: false` lets `Orders::Cancel` delegate and batch carrier I/O after its own transaction), `after_cancel`/`after_resume` are deprecated shells and the only trace left on the model — never add public model methods for workflows to call. **Status model (2026-08-11, question 14): the machine is REMOVED.** `status` = plain `HasStatus` `unfulfilled → fulfilled → delivered | canceled` (`pending`/`ready`/`ready_for_pickup` collapse — payment/stock gating is a `Fulfillments::Fulfill` validate guard, pickup renders modality-aware labels); `delivered` = confirmed receipt (`Fulfillments::MarkDelivered`, `delivered_at`, `fulfillment.delivered`) — the returns window + EU withdrawal anchor; carrier truth is the separate `tracking_status` axis (data, never a machine) written by `Fulfillments::UpdateTracking`, fed by EasyPost tracker webhooks (opt-in trackers for hand-entered numbers). Rollup domain `backorder | canceled | partial | unfulfilled | fulfilled | delivered`. **Phase 7 shipped 2026-08-11** (core + API + dashboard + EasyPost tracker webhook + `spree:migrate_fulfillment_statuses`); **label leads, fulfilled follows (2026-08-12):** `Fulfillments::PurchaseLabel` = explicit pre-ship label buy (loud failure, no email); `Fulfill` buys label BEFORE marking fulfilled (email always carries tracking; post-split failure keeps the split, never rolls it back); providers declare `generates_labels?` + idempotent `create_fulfillment`. **One tracking number per fulfillment (2026-08-11, question 15):** diverging parcels are split fulfillments; a `spree_fulfillment_trackings` model is 6.1 work and must absorb the entire carrier axis (per-row status/`delivered_at`, webhook matching by row) — never split the axis across fulfillment and tracking rows-- `6.0-digital-assets.md` — `Spree::Digital` → `Spree::DigitalAsset` (full table + FK rename with one-release bridges; `DigitalLink` keeps its name; design finalized 2026-08-10) plus the missing management/delivery surface: Admin API v3 (assets nested under products, link `reset`, resend; catalog: assets ride `products`, link management rides `orders`), dashboard product card + order links + Downloads settings, dedicated `Spree::DigitalAssetMailer` (`files_ready_email` / opt-in `file_updated_email`), customer `GET /store/account/digital_links` + store SDK resource, `digital_link.downloaded` domain event (no log table), signed-URL download transport (dead `digital_asset_link_expire_time` pref becomes the TTL), phantom `:digital` product param removed. Per-asset nullable `authorized_clicks`/`authorized_days` fall back to store settings — a recorded exception to the store-scoped-configuration no-fallback rule. **Constraints now:** new code uses `DigitalAsset`/`digital_assets` names only; nothing outside the model assumes an attachment is present (asset kinds + license-key pools groomed for 6.1); emailed download URLs keep resolving across renames one release.+- `6.0-digital-assets.md` — **COMPLETE (2026-08-10, all five waves).** `Spree::Digital` → `Spree::DigitalAsset` (table + FK renamed; `DigitalLink` keeps its name) with one-release bridges: constant alias, deprecated `digitals` twins, dual-emitted `digital.*` events, `PermittedAttributes.digital_attributes`, legacy `store/digitals/:token` route. Shipped on top: Admin API v3 (assets nested under products with private-storage direct upload, `digital_links` read + `reset`, order `resend_digital_links`; catalog — assets ride `products`, links ride `orders`), dashboard (product Digital files card, order links card, store Downloads settings), `Spree::DigitalAssetMailer#files_ready_email` on `order.placed` (+ resend), customer `GET /store/customers/me/digital_links` + store SDK resource, `digital_link.downloaded` event (no log table), signed-URL download transport clamped to the link's own expiry with `digital_asset_link_expire_time` capped at 1h, phantom `:digital` product param removed. Per-asset nullable `authorized_clicks`/`authorized_days` fall back to store settings — a recorded exception to the store-scoped-configuration no-fallback rule. **Constraints now:** new code uses `DigitalAsset`/`digital_assets` names only; nothing outside the model assumes an attachment is present (asset kinds + license-key pools groomed for 6.1); emailed download URLs keep resolving across renames one release; the generated OpenAPI specs still need the pre-release regeneration pass.- `6.0-returns-exchanges-claims.md` — First-class Return, Exchange, Claim models replacing ReturnAuthorization/Reimbursement chain. **COMPLETE (2026-08-05):** all three entities (+ permanent `ReturnLineItem`/`ExchangeLineItem`/`ClaimLineItem` line items), `Spree::HasStatus`, all fifteen workflows (each with a leading `validate` hook), `Refund#originator`, admin + store v3 APIs (transitions as PATCH member actions; no destroy — cancel instead), dashboard pages. Legacy chain **removed**: ReturnAuthorization/CustomerReturn/Reimbursement/ReimbursementType/legacy ReturnItem + eligibility validators + ReturnsCalculator classes all deleted, but their **tables deliberately survive to 6.1** as the data migration's source and rollback path. `spree:upgrade:migrate_returns` (`Spree::ReturnsMigrator`, defined in the rake file like its sibling upgrade tasks; anonymous-AR readers) is in the 5.6→6.0 manifest after the adjustments step; it needs no cursor because the preserved `number` is uniquely indexed on the new tables, so "what's left" is a `where.not(number: ...)` query and an interrupted run resumes for free. `ReturnAuthorizationReason`→`ReturnReason` (alias one release) + new `ClaimReason`; `Metafields` on all three. Capability replacements: `Spree::ReturnMailer#refunded_email` on `return.refunded` (replaces the reimbursement email), `Order#outstanding_balance` drops the reimbursement term (refunds already net out of `payment_total`), `Return#refunded_total` counts store credits too, store credit issued with `originator` + `memo` only (categories dropped 2026-08-18). **Reasons** ship admin-only CRUD (`/api/v3/admin/{return,claim,refund}_reasons`, `settings` scope) + a combined Settings → Reasons dashboard page + reason pickers on the create dialogs; `mutable` is never client-writable and the immutability guard lives on `Spree::NamedType` (`can_be_deleted?` + rename/destroy guards) because secret API keys authorize by scope and never consult CanCanCan. **No state machines (2026-08-02):** plain `status` string + inclusion validation; all fifteen transitions are workflows (`Returns::Receive`, `Exchanges::Fulfill`, `Claims::Resolve`, …) with `validate` hooks for return-eligibility policy and refunds as `external_step`. Nothing happens in a model or transition callback. Statuses live in a `class_attribute` via the core `Spree::HasStatus` concern (`has_status` + additive `add_status(value, after:)`, generating predicates and scopes) — extensible by design, additive only, and no transition graph (that would be a state machine again). **Return eligibility is a hook, not a policy engine (2026-08-03):** no window/restocking-fee/final-sale flag in core — a `validate` handler decides, enforcing for customers while letting staff override (it reads `created_by`), and region-varying policy reads `order.market`. Medusa/Saleor/Vendure ship no policy at all; Shopify's engine has no API. A `ReturnPolicy` model can arrive later behind the same hook.- `6.0-platform-auth.md` — Drop Devise, own auth stack, User→Customer/Staff rename (RefreshToken shipped in 5.4)- `6.0-store-context-and-first-run-setup.md` — Store context becomes credential-derived (design finalized 2026-08-13): publishable key selects the store on the Store API, Admin API honors `X-Spree-Store-Id` with membership checked against the *requested* store (header-less JWT → default store + deprecation, required 6.1), hostname-based store resolution retired (`FindDefault`'s `url:` is dead; never read `request.host` to pick a store). First-run setup replaces the `[email protected]`/`spree123` dummy seed: seed creates an admin only when `ADMIN_EMAIL`/`ADMIN_PASSWORD` are explicitly set; otherwise a one-time setup-token flow (dashboard `/setup` + unauthenticated `auth/setup` endpoints; `has_secure_token :setup_token` on Store — plaintext like invitation tokens, printed by installer, `spree:setup:token` reprints, cleared on completion — required in EVERY environment; `Spree::Stores::DashboardUrl` is the single resolver for the dashboard origin — used by the setup link, invitation emails and the SSO callback — resolving `dashboard_url` pref/`SPREE_DASHBOARD_URL` → deprecated `admin_url` → this app's own `/dashboard` mount when `spree_dashboard` serves a build → dev Vite → store URL; never a hardcoded port, and the CLI rebuilds the link host-side since the seed runs before any dashboard is up). **App configuration reads ENV:** `RuntimeConfiguration.preference` accepts `env:` (precedence: explicit value → env var → coded default), so deployment settings are configurable without touching Ruby; `dashboard_url` is env-backed via `SPREE_DASHBOARD_URL` and `admin_url` is deprecated in its favour. Applies to `Spree::Config` only — per-store behavior belongs in Store preferences. The setup flow creates the first admin and adopts/renames the seeded store; no general store CRUD in the OSS Admin API. **Constraints now:** never assume `current_store == Store.default` in Admin API code; store-touching cache keys include the store id by construction (enforced by the cache-key audit spec in core — global data needs a reviewed allowlist entry); new scripts pass `ADMIN_EMAIL`/`ADMIN_PASSWORD` explicitly. **Isolation tripwires (2026-08-13):** `Spree::StoreScopeGuard` wraps every v3 API request in dev/test and flags store-less secondary-key lookups and unscoped scans on store-owned tables (schema-derived set; id/FK filters and `SELECT 1 AS one` are exempt as loads-from-scoped-rows and uniqueness validations — exemption is NOT proof of scoping, request-derived ids still need `current_store` fetching; `log` default, `raise` in this repo's API suite, `SPREE_STORE_SCOPE_GUARD` to change) — wrap deliberately global lookups in `Spree::StoreScopeGuard.skip { }`. A store-owned model with an unscoped `acts_as_list` also fails the core suite (positions bleed across stores). **Country-aware setup (2026-08-15, shipped):** setup asks for `country_code` (required) plus `locale` (country's official languages, filtered to those Spree translates, + English) and `currency` — both optional to the endpoint and defaulted from the country, both editable in the form; an unresolvable currency is a pre-token-spend 422, never silently ignored. Country data from unauthenticated `GET auth/setup/countries`. `Spree::Stores::ProvisionDefaults.call(store:, country:, locale:, currency:)` owns every country-derived per-store default (bootstrap market updated in place, warehouse country, Domestic/International zones + flat rates, pickup method — all in the derived currency) and absorbs the `StockLocations`/`DeliveryZones`/`PickupDelivery` seeds; exactly two callers — the setup endpoint and `Seeds::AdminUser`'s env branch (`STORE_COUNTRY`/`STORE_LOCALE`/`STORE_CURRENCY`, defaults `US`/`en`). It also restates seeded zero-amount rates (digital delivery) into the store currency. Sample data builds around the default market, never resets it. **Constraints:** a store's country changes through its **market**, never `Store#default_country_code=` (on a store with a market that writer is a dead column — readers delegate to the market, the after_update sync copies locale/currency only); country- or currency-dependent seeds go into `ProvisionDefaults`, not `Seeds::All`; never give the service a third caller.diff --git a/docs/api-reference/webhooks-events.mdx b/docs/api-reference/webhooks-events.mdxindex 37be556840..deb19c9440 100644--- a/docs/api-reference/webhooks-events.mdx+++ b/docs/api-reference/webhooks-events.mdx@@ -763,22 +763,29 @@ Events: `newsletter_subscriber.created`, `newsletter_subscriber.updated`, `newsl}```-## Digital Product Events+## Digital Asset Events-Events: `digital.created`, `digital.updated`, `digital.deleted`+Events: `digital_asset.created`, `digital_asset.updated`, `digital_asset.deleted`++The legacy `digital.created` / `digital.updated` / `digital.deleted` names are+still emitted alongside these for one release and are removed in Spree 6.1 —+subscribe to the `digital_asset.*` names.```json{"id": "dig_3xLq8nRt","variant_id": "var_k5nR8xLq",- "created_at": "2025-01-01T00:00:00Z",- "updated_at": "2025-01-01T00:00:00Z"+ "filename": "ebook.pdf",+ "content_type": "application/pdf"}```## Digital Link Events-Events: `digital_link.created`, `digital_link.updated`, `digital_link.deleted`+Events: `digital_link.created`, `digital_link.updated`, `digital_link.deleted`, `digital_link.downloaded`++`digital_link.downloaded` fires each time a customer successfully downloads the+file, after the access counter has been incremented.```json{@@ -786,7 +793,8 @@ Events: `digital_link.created`, `digital_link.updated`, `digital_link.deleted`"access_counter": 3,"filename": "ebook.pdf","content_type": "application/pdf",- "download_url": "/api/v3/store/digital_downloads/abc123",+ "download_url": "/api/v3/store/digital_links/abc123",+ "expires_at": "2025-01-22T10:30:00Z","authorizable": true,"expired": false,"access_limit_exceeded": false,diff --git a/docs/developer/upgrades/5.6-to-6.0.mdx b/docs/developer/upgrades/5.6-to-6.0.mdxindex 98c6ef624c..df9fb1e0c9 100644--- a/docs/developer/upgrades/5.6-to-6.0.mdx+++ b/docs/developer/upgrades/5.6-to-6.0.mdx@@ -291,6 +291,8 @@ A handler receives the workflow (so it can read `order`, `items`, `created_by`,- **Digital downloads redirect instead of streaming.** The download endpoint now answers `302` with a short-lived signed URL rather than sending the file bytes directly, so a large download no longer occupies a web worker. Clients that read the response body must follow redirects (most HTTP clients and every browser already do). The link's own lifetime is unchanged; `digital_asset_link_expire_time` (default 300 seconds) — previously unused — now sets how long the signed URL stays valid, and is capped at one hour because that URL is a bearer credential. The signed URL is additionally clamped so it can never outlive the download link that issued it.- **Download limits can be set per asset.** `authorized_clicks` and `authorized_days` on a digital asset override the store's download settings; left blank, the store settings apply as before.- **A successful download publishes `digital_link.downloaded`**, so downloads are visible to webhooks and subscribers for the first time.+- **Customers are emailed their download links** when the order is placed, from the new `Spree::DigitalAssetMailer` in the optional `spree_emails` gem. Hosts that already send their own download email should either suppress it (`send_consumer_transactional_emails`) or drop their own. The dashboard's order page can re-send it.+- **Digital assets are managed through the Admin API and dashboard**, and signed-in customers can list everything they have bought at `GET /api/v3/store/customers/me/digital_links`.## Dependency injection changesdiff --git a/docs/plans/6.0-digital-assets.md b/docs/plans/6.0-digital-assets.mdindex e96eea1101..1b62b8d88c 100644--- a/docs/plans/6.0-digital-assets.md+++ b/docs/plans/6.0-digital-assets.md@@ -1,6 +1,6 @@# Digital Assets: Rename, Admin Management, Delivery-**Status:** In Progress — wave 1 (rename) shipped 2026-08-10; waves 2–4 pending+**Status:** Complete — all five waves shipped 2026-08-10**Target:** Spree 6.0**Depends on:** `6.0-fulfillment-and-delivery.md` (Digital fulfillment provider, shipped), `6.0-admin-api.md` (endpoint conventions), `6.0-admin-spa.md` (dashboard architecture), `6.0-admin-rbac.md` (permission catalog), `6.0-store-scoped-configuration.md` (preference conventions)**Author:** Damian Legawiec@@ -68,10 +68,10 @@ The store download action (`GET /api/v3/store/digital_links/:token`) calls `auth## Migration Path1. **Rename wave (core)** — **shipped 2026-08-10**: migration (table + FK rename, override columns), model/file/serializer rename, constant alias + deprecated twin associations, dual-emit events, dependencies key bridge, effective-limit readers. Also landed opportunistically because they touched the same files: the canonical `digital_links/:token` route with the legacy path bridged, signed-URL download transport (resurrecting `digital_asset_link_expire_time` as the TTL), the `digital_link.downloaded` event, removal of the phantom `:digital` product param, and the use-case doc correction. Core (7406 examples) and API (2714 examples) suites green; types, Zod schemas and OpenAPI regenerated.-2. **Admin API wave**: catalog entries (`DigitalAsset` → `:products`, link reset → `:orders`), controllers + routes + serializers, remove the phantom `:digital` product param, integration specs, typelizer + OpenAPI regeneration.-3. **Dashboard wave**: admin-sdk resources, product card, order-page links + reset + resend, settings section, e2e specs.-4. **Delivery wave**: mailer + subscriber, customer downloads endpoint + store SDK resource, signed-URL transport + `digital_link.downloaded` event, canonical route + legacy route bridge.-5. **Docs correction** (can land first, independently): `docs/use-case/digital-products/admin-capabilities.mdx` currently describes management screens, release triggers, resendable emails, and download logs that do not exist — trim to reality now, re-expand as waves ship.+2. **Admin API wave** — **shipped 2026-08-10**: catalog entries (`DigitalAsset` → `:products`, link reset → `:orders`), controllers + routes + serializers, remove the phantom `:digital` product param, integration specs, typelizer + OpenAPI regeneration.+3. **Dashboard wave** — **shipped 2026-08-10**: admin-sdk resources, product-page Digital files card (upload to private storage, per-file limit overrides, delete), order-page links card (status, reset, resend), store settings Downloads section, translations in all six locales. No e2e spec yet — the card is covered by API-level specs; add browser coverage when the digital-product flow gets an e2e pass.+4. **Delivery wave** — **shipped 2026-08-10**: mailer + subscriber, customer downloads endpoint + store SDK resource, signed-URL transport + `digital_link.downloaded` event, canonical route + legacy route bridge.+5. **Docs correction** — **shipped 2026-08-10**: `admin-capabilities.mdx` was trimmed to reality in wave 1, then re-expanded as the waves landed; the upgrade guide records the renames, the transport change, the new email and the customer endpoint; the webhook reference documents `digital_asset.*` as canonical with `digital.*` marked deprecated. The generated OpenAPI specs are deliberately left for the pre-release regeneration pass.## Constraints on Current Work@@ -84,12 +84,12 @@ The store download action (`GET /api/v3/store/digital_links/:token`) calls `auth## Open Questions-Only deferred items remain; nothing blocks implementation.+All five waves have shipped. Only deferred items remain.-1. **Asset kinds** (`external_url`, provider-backed for third-party repositories/licensing) and **license key pools** (pre-generated keys per variant, one consumed per purchase) — groom for 6.1 once this plan ships. Unblocked by: this plan's waves landing, plus a concrete integration target to design the provider contract against.+1. **Asset kinds** (`external_url`, provider-backed for third-party repositories/licensing) and **license key pools** (pre-generated keys per variant, one consumed per purchase) — groom for 6.1. Unblocked now that the waves have landed; still wants a concrete integration target to design the provider contract against.2. **Per-download log rows** (IP, user agent, per-download timestamps) — revisit if merchants ask for more than the counter + event; the event payload is designed so a subscriber can build this externally today.## References- Plans: `6.0-admin-api.md` (the four unchecked digital-asset endpoints this plan implements), `6.0-product-types.md` (variant-level fulfillment-type gap, 6.1 relief valve), `6.0-multi-vendor-marketplace.md` (vendor-owned digital catalogs intersect at 6.1), `6.0-store-scoped-configuration.md` (preference rule this plan records an exception to), `docs/plans/decisions.md` 2026-08-10.-- Code: `spree/core/app/models/spree/digital.rb`, `digital_link.rb`, `spree/core/app/models/concerns/spree/purchase/digital_items.rb`, `spree/core/app/models/spree/fulfillment_provider/digital.rb`, `spree/core/app/workflows/spree/orders/complete.rb`, `spree/api/app/controllers/spree/api/v3/store/digitals_controller.rb`, `spree/core/lib/spree/core/permission_configuration.rb`.+- Code: `spree/core/app/models/spree/digital_asset.rb`, `digital_link.rb`, `spree/core/app/models/concerns/spree/purchase/digital_items.rb`, `spree/core/app/models/spree/fulfillment_provider/digital.rb`, `spree/core/app/workflows/spree/orders/complete.rb`, `spree/api/app/controllers/spree/api/v3/store/digital_links_controller.rb`, `spree/core/lib/spree/core/permission_configuration.rb`.diff --git a/docs/use-case/digital-products/admin-capabilities.mdx b/docs/use-case/digital-products/admin-capabilities.mdxindex e0a432da93..b511d78e37 100644--- a/docs/use-case/digital-products/admin-capabilities.mdx+++ b/docs/use-case/digital-products/admin-capabilities.mdx@@ -11,12 +11,13 @@ Below is a breakdown of the key capabilities available to store administrators.- Configure any product to be digital-only, physical, or a hybrid (e.g., physical textbook with downloadable companion PDF).- Attach digital files (PDFs, ZIPs, etc.) to any product variant — including variants of physical products, so a manual or warranty document ships alongside the goods.+- Upload, replace and remove files from the **Digital files** card on the product page. Replacing a file updates it for everyone who already bought it; nobody loses access.## Download Access Management-- Limit how long a download link stays valid and how many times it can be used.-- Set those limits once for the whole store, or override either of them on an individual file — so an evergreen download and a time-limited course can live in the same catalog.-- Reset a customer's download link when they run out of attempts.+- Limit how long a download link stays valid and how many times it can be used, from **Settings → Store**.+- Override either limit on an individual file, so an evergreen download and a time-limited course can live in the same catalog. Leave a file's limits blank and the store settings apply.+- Restore a customer's access from the order page when they run out of attempts or a download failed.## Delivery Step Bypass@@ -26,11 +27,12 @@ Below is a breakdown of the key capabilities available to store administrators.## Automated Digital Delivery- Digital items are fulfilled automatically when the order is placed — download links are ready immediately, with no manual step.-- Customers access their downloads through your storefront or app, which reads the links from the order.+- Customers are emailed their download links as soon as the order is placed, and you can re-send that email from the order page at any time.+- Signed-in customers can also retrieve everything they have bought from your storefront or app, across all their orders.## Download Visibility-- Every download increments a counter on the link, so you can see how many times a file has been fetched.+- The order page shows each file a buyer received: how many downloads they have used, when access lapses, and whether it has run out.- A `digital_link.downloaded` event fires on each successful download, so you can feed downloads into your own auditing, analytics, or fraud tooling via webhooks.## Security and Permissions