Skip to content

armgit / spree

Public Imported from GitHub
0

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.

Update outdated docs

Damian Legawiec62da60a9e895
diff --git a/docs/api-reference/admin-api/authentication.mdx b/docs/api-reference/admin-api/authentication.mdx
index 677ee5c00e..1c32332c99 100644
--- a/docs/api-reference/admin-api/authentication.mdx
+++ b/docs/api-reference/admin-api/authentication.mdx
@@ -92,18 +92,20 @@ curl -X POST 'https://store.example.com/api/v3/admin/auth/login' \
### Token refresh
-JWT tokens expire after 1 hour by default. Refresh them with the current token:
+Admin JWT tokens are short-lived — they expire after 5 minutes by default (configurable with `SPREE_ADMIN_JWT_EXPIRATION`, in seconds). Login also sets a refresh token in an HttpOnly cookie scoped to `/api/v3/admin/auth`; it is never returned in the response body. Exchange that cookie for a new access token:
<CodeGroup>
```typescript SDK
-const { token } = await client.auth.refresh({ token: currentToken })
+// Sends the refresh cookie set at login; the cookie is rotated on every call
+const { token } = await client.auth.refresh()
+client.setToken(token)
```
```bash cURL
+# Log in with -c cookies.txt to store the refresh cookie, then:
curl -X POST 'https://store.example.com/api/v3/admin/auth/refresh' \
- -H 'X-Spree-Api-Key: sk_xxx' \
- -H 'Authorization: Bearer <current_jwt_token>'
+ -b cookies.txt -c cookies.txt
```
</CodeGroup>
@@ -119,7 +121,10 @@ Each secret API key carries a list of **scopes** that grant access to specific r
| Scope | Grants access to |
|---|---|
| `read_orders` / `write_orders` | `/orders/*` — including nested items and adjustments |
-| `read_products` / `write_products` | `/products/*`, `/variants/*`, `/option_types/*`, `/media/*`, `/prices/*`, `/price_lists/*` |
+| `read_products` / `write_products` | `/products/*`, `/variants/*`, `/option_types/*`, `/prices/*`, `/price_lists/*`, `/catalogs/*`, `/digital_assets/*`, `/imports/*` |
+| `read_product_types` / `write_product_types` | `/product_types/*` |
+| `read_publishing` / `write_publishing` | Publishing products to channels |
+| `read_media` / `write_media` | `/media/*` |
| `read_promotions` / `write_promotions` | `/promotions/*` — including nested rules, actions, and coupon codes |
| `read_customers` / `write_customers` | `/customers/*`, `/customer_groups/*` — including nested addresses and credit cards |
| `read_payments` / `write_payments` | `/orders/:id/payments` — including capture and void |
@@ -127,12 +132,22 @@ Each secret API key carries a list of **scopes** that grant access to specific r
| `read_refunds` / `write_refunds` | `/orders/:id/refunds` |
| `read_gift_cards` / `write_gift_cards` | `/gift_cards/*`, `/gift_card_batches/*`, `/orders/:id/gift_cards` |
| `read_store_credits` / `write_store_credits` | `/customers/:id/store_credits`, `/orders/:id/store_credits` |
-| `read_stock` / `write_stock` | `/stock_locations/*`, `/stock_items/*`, `/stock_transfers/*`, `/stock_reservations/*` |
+| `read_stock` / `write_stock` | `/stock_locations/*`, `/stock_levels/*`, `/stock_movements/*`, `/stock_transfers/*`, `/stock_reservations/*`, `/stock_receipts/*` |
+| `read_purchasing` / `write_purchasing` | `/suppliers/*`, `/purchase_orders/*`, `/stock_receipts/*` |
| `read_categories` / `write_categories` | `/categories/*` |
-| `read_settings` / `write_settings` | Store configuration — `/store`, `/payment_methods/*`, `/markets/*`, `/channels/*`, `/tax_categories/*`, `/countries`, `/custom_field_definitions/*`, staff management (`/admin_users`, `/invitations`, `/roles`), `/allowed_origins/*` |
+| `read_collections` / `write_collections` | `/collections/*` |
+| `read_sellers` / `write_sellers` | `/sellers/*`, `/seller_requirements/*` |
+| `read_commissions` / `write_commissions` | `/commission_rates/*`, `/commission_lines/*` |
+| `read_payouts` / `write_payouts` | `/seller_transfers/*`, `/seller_payouts/*` |
+| `read_settings` / `write_settings` | Store configuration — `/store`, `/payment_methods/*`, `/markets/*`, `/channels/*`, `/tax_categories/*`, `/custom_field_definitions/*`, `/allowed_origins/*` |
+| `read_staff` / `write_staff` | Staff management — `/admin_users/*`, `/invitations/*`, `/roles/*` |
+| `read_delivery_methods` / `write_delivery_methods` | `/delivery_methods/*` — including rules and carrier services |
+| `read_package_types` / `write_package_types` | `/package_types/*` |
+| `read_integrations` / `write_integrations` | `/integrations/*` |
| `read_webhooks` / `write_webhooks` | `/webhook_endpoints/*` — including delivery logs and redelivery |
| `read_api_keys` / `write_api_keys` | `/api_keys/*` — creating, revoking, and deleting API keys |
| `read_dashboard` | `/dashboard/*` (analytics; read-only) |
+| `read_reports` / `write_reports` | Reports, `/saved_reports/*` and report exports |
Custom field **values** are gated by the resource they're attached to: a `write_products` key can manage custom fields on products, variants, and option types; `write_orders` covers order custom fields, and so on. Custom field **definitions** (the schema) are part of `settings`.
@@ -164,30 +179,35 @@ If the key lacks the required scope, the API returns `403 Forbidden`:
The `details.required_scope` field tells you exactly which scope to add — and `spree api-key create --type secret --scopes <scope>` mints a key that has it. Choose the narrowest set that covers your integration's needs.
-### JWT bearer tokens: CanCanCan abilities
+### JWT bearer tokens: role permissions
-JWT-authenticated admin users are authorized via [CanCanCan](https://github.com/CanCanCommunity/cancancan) abilities derived from their `Spree::Role`s. The SPA uses this fine-grained model to render UI conditionally; partial-permission staff users see only the resources their role grants.
+JWT-authenticated admin users pass the same per-controller gate as secret keys. Instead of key scopes, the gate checks the permission keys held by the user's `Spree::Role`s on the current store — the same `read_<resource>` / `write_<resource>` vocabulary. The SPA reads those keys from `GET /api/v3/admin/me` to render UI conditionally; partial-permission staff users see only the resources their role grants.
-If the caller lacks permission for a specific action, the API returns `403 Forbidden`:
+If the user's role lacks the required key, the API returns `403 Forbidden`:
```json
{
"error": {
"code": "access_denied",
- "message": "You are not authorized to perform this action"
+ "message": "Missing permission: write_orders",
+ "details": {
+ "required_permission": "write_orders"
+ }
}
}
```
+A `403` without `details.required_permission` means the user holds the key but a record-level rule refused the action.
+
## Authentication summary
| Method | Header | Use case | Authorization |
|---|---|---|---|
| Secret API key | `X-Spree-Api-Key: sk_xxx` | Server-to-server integrations | Scopes |
-| JWT token | `Authorization: Bearer <token>` | Interactive admin sessions; SPA | CanCanCan abilities |
+| JWT token | `Authorization: Bearer <token>` | Interactive admin sessions; SPA | Role permissions |
<Note>
-If both headers are present, the JWT token wins: CanCanCan applies and scopes are ignored. This lets you use `sk_xxx` to bootstrap a session and then issue per-user JWTs for individual admin actions.
+If both headers are present, the JWT token wins: the user's role permissions apply and the key's scopes are ignored. This lets you use `sk_xxx` to bootstrap a session and then issue per-user JWTs for individual admin actions.
</Note>
## Who a write is attributed to
@@ -218,7 +238,7 @@ Expanding the association gives the same three facts in one object — `id`,
<Tabs>
<Tab title="SDK">
```ts
-const order = await client.orders.retrieve('or_m3Rp9wXz', { expand: ['canceler'] })
+const order = await client.orders.get('or_m3Rp9wXz', { expand: ['canceler'] })
order.canceler // { id: 'key_8QrN3xLq', type: 'api_key', label: 'WMS connector' }
```
diff --git a/docs/api-reference/admin-api/endpoints.mdx b/docs/api-reference/admin-api/endpoints.mdx
index 862790f71f..6f0369f0fc 100644
--- a/docs/api-reference/admin-api/endpoints.mdx
+++ b/docs/api-reference/admin-api/endpoints.mdx
@@ -6,7 +6,7 @@ description: "Every Spree Admin API v3 endpoint at a glance — method, path, re
{/* Generated from docs/api-reference/admin.yaml by packages/cli/scripts/generate-endpoints-doc.mjs — do not edit by hand. */}
-All 209 Admin API operations, with the [scope](/api-reference/admin-api/authentication) a secret API key needs for each. JWT-authenticated admin users are governed by their roles instead of scopes. The same index is available offline via the CLI: `spree api endpoints`.
+All 404 Admin API operations, with the [scope](/api-reference/admin-api/authentication) a secret API key needs for each. JWT-authenticated admin users are governed by their roles instead of scopes. The same index is available offline via the CLI: `spree api endpoints`.
Endpoints marked — are exempt from scope checks (authentication and session endpoints) or resolve their scope at request time.
@@ -14,10 +14,10 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| Method | Path | Required scope | Summary |
|---|---|---|---|
-| `GET` | `/admin_users` | `read_settings` | List staff |
-| `GET` | `/admin_users/{id}` | `read_settings` | Show a staff member |
-| `PATCH` | `/admin_users/{id}` | `write_settings` | Update a staff member |
-| `DELETE` | `/admin_users/{id}` | `write_settings` | Remove a staff member from this store |
+| `GET` | `/admin_users` | `read_staff` | List staff |
+| `GET` | `/admin_users/{id}` | `read_staff` | Show a staff member |
+| `PATCH` | `/admin_users/{id}` | `write_staff` | Update a staff member |
+| `DELETE` | `/admin_users/{id}` | `write_staff` | Remove a staff member from this store |
## Allowed origins
@@ -48,6 +48,29 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `POST` | `/auth/login` | — | Login |
| `POST` | `/auth/refresh` | — | Refresh token |
| `POST` | `/auth/logout` | — | Logout |
+| `POST` | `/auth/password_resets` | — | Request password reset |
+| `PATCH` | `/auth/password_resets/{id}` | — | Reset password |
+| `GET` | `/auth/setup` | — | Check first-run setup availability |
+| `POST` | `/auth/setup` | — | Complete first-run setup |
+| `GET` | `/auth/setup/countries` | — | List countries for first-run setup |
+
+## Catalogs
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/catalogs` | `read_products` | List catalogs |
+| `POST` | `/catalogs` | `write_products` | Create a catalog |
+| `POST` | `/catalogs/{id}/assign` | `write_products` | Assign a catalog to an audience |
+| `GET` | `/catalogs/{catalog_id}/products` | `read_products` | List catalog products |
+| `POST` | `/catalogs/{catalog_id}/products` | `write_products` | Add products to a catalog |
+| `DELETE` | `/catalogs/{catalog_id}/products` | `write_products` | Remove products from a catalog |
+| `GET` | `/catalogs/{catalog_id}/order_minimums` | `read_products` | List catalog order minimums |
+| `POST` | `/catalogs/{catalog_id}/order_minimums` | `write_products` | Create a catalog order minimum |
+| `PATCH` | `/catalogs/{catalog_id}/order_minimums/{id}` | `write_products` | Update a catalog order minimum |
+| `DELETE` | `/catalogs/{catalog_id}/order_minimums/{id}` | `write_products` | Delete a catalog order minimum |
+| `PUT` | `/catalogs/{catalog_id}/quantity_rules` | `write_products` | Set catalog quantity rules |
+| `PATCH` | `/catalogs/{id}/activate` | `write_products` | Activate a catalog |
+| `PATCH` | `/catalogs/{id}/deactivate` | `write_products` | Deactivate a catalog |
## Categories
@@ -60,7 +83,8 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `DELETE` | `/categories/{id}` | `write_categories` | Delete a category |
| `PATCH` | `/categories/{id}/reposition` | `write_categories` | Reposition a category |
| `GET` | `/categories/{category_id}/products` | `read_categories` | List category products |
-| `POST` | `/categories/{category_id}/products` | `write_categories` | Add a product to a category |
+| `POST` | `/categories/{category_id}/products` | `write_categories` | Add products to a category |
+| `DELETE` | `/categories/{category_id}/products` | `write_categories` | Remove products from a category |
| `PATCH` | `/categories/{category_id}/products/{id}/reposition` | `write_categories` | Reposition a category product |
## Channels
@@ -74,6 +98,75 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `DELETE` | `/channels/{id}` | `write_settings` | Delete a channel |
| `POST` | `/channels/{id}/add_products` | `write_products` | Publish products on a channel |
| `POST` | `/channels/{id}/remove_products` | `write_products` | Unpublish products from a channel |
+| `GET` | `/channels/{channel_id}/order_routing_rules` | `read_settings` | List order routing rules for a channel |
+| `POST` | `/channels/{channel_id}/order_routing_rules` | `write_settings` | Create an order routing rule on a channel |
+| `PATCH` | `/channels/{channel_id}/order_routing_rules/{id}` | `write_settings` | Update an order routing rule |
+| `DELETE` | `/channels/{channel_id}/order_routing_rules/{id}` | `write_settings` | Delete an order routing rule |
+
+## Claim reasons
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/claim_reasons` | `read_settings` | List claim reasons |
+| `POST` | `/claim_reasons` | `write_settings` | Create a claim reason |
+| `GET` | `/claim_reasons/{id}` | `read_settings` | Get a claim reason |
+| `PATCH` | `/claim_reasons/{id}` | `write_settings` | Update a claim reason |
+| `DELETE` | `/claim_reasons/{id}` | `write_settings` | Delete a claim reason |
+
+## Collection rules
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/collection_rules/types` | `read_collections` | List available collection rule types |
+
+## Collections
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/collections` | `read_collections` | List collections |
+| `POST` | `/collections` | `write_collections` | Create a collection |
+| `GET` | `/collections/{id}` | `read_collections` | Get a collection |
+| `PATCH` | `/collections/{id}` | `write_collections` | Update a collection |
+| `DELETE` | `/collections/{id}` | `write_collections` | Delete a collection |
+| `GET` | `/collections/{collection_id}/products` | `read_collections` | List collection products |
+| `POST` | `/collections/{collection_id}/products` | `write_collections` | Add products to a collection |
+| `DELETE` | `/collections/{collection_id}/products` | `write_collections` | Remove products from a collection |
+| `PATCH` | `/collections/{collection_id}/products/{id}/reposition` | `write_collections` | Reposition a collection product |
+
+## Commission lines
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/commission_lines` | `read_commissions` | List commission lines |
+| `GET` | `/commission_lines/{id}` | `read_commissions` | Get a commission line |
+
+## Commission rates
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/commission_rates` | `read_commissions` | List commission rates |
+| `POST` | `/commission_rates` | `write_commissions` | Create a commission rate |
+| `GET` | `/commission_rates/rule_types` | `read_commissions` | List the commission rule kinds |
+| `GET` | `/commission_rates/{id}` | `read_commissions` | Get a commission rate |
+| `PATCH` | `/commission_rates/{id}` | `write_commissions` | Update a commission rate |
+| `DELETE` | `/commission_rates/{id}` | `write_commissions` | Delete a commission rate |
+
+## Companies
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/companies/{company_id}/memberships` | `read_customers` | List company members |
+| `POST` | `/companies/{company_id}/memberships` | `write_customers` | Add a member by email |
+| `GET` | `/companies/{company_id}/tax_exemption_certificates` | `read_customers` | List tax exemption certificates |
+| `POST` | `/companies/{company_id}/tax_exemption_certificates` | `write_customers` | Create a tax exemption certificate |
+| `PATCH` | `/companies/{company_id}/tax_exemption_certificates/{id}/verify` | `write_customers` | Verify a tax exemption certificate |
+| `PATCH` | `/companies/{company_id}/tax_exemption_certificates/{id}/revoke` | `write_customers` | Revoke a tax exemption certificate |
+| `GET` | `/companies/{company_id}/tax_exemption_certificates/{id}/download` | `read_customers` | Download a certificate document |
+| `GET` | `/companies/{company_id}/tax_identifiers` | `read_customers` | List company tax registrations |
+| `POST` | `/companies/{company_id}/tax_identifiers` | `write_customers` | Create a company tax registration |
+| `POST` | `/companies/{company_id}/tax_identifiers/{id}/validate` | `write_customers` | Re-check a company tax registration |
+| `GET` | `/companies` | `read_customers` | List companies |
+| `POST` | `/companies` | `write_customers` | Create a company |
## Custom field definitions
@@ -84,6 +177,7 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `GET` | `/custom_field_definitions/{id}` | `read_settings` | Show a custom field definition |
| `PATCH` | `/custom_field_definitions/{id}` | `write_settings` | Update a custom field definition |
| `DELETE` | `/custom_field_definitions/{id}` | `write_settings` | Delete a custom field definition |
+| `GET` | `/custom_field_definitions/resource_types` | `read_settings` | List what custom fields can be attached to |
## Customer groups
@@ -99,6 +193,8 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| Method | Path | Required scope | Summary |
|---|---|---|---|
+| `GET` | `/customers/{id}/export` | `read_customers` | Export a customer's personal data |
+| `POST` | `/customers/{id}/anonymize` | `write_customers` | Erase a customer's personal data |
| `GET` | `/customers/{customer_id}/addresses` | `read_customers` | List customer addresses |
| `POST` | `/customers/{customer_id}/addresses` | `write_customers` | Create a customer address |
| `PATCH` | `/customers/{customer_id}/addresses/{id}` | `write_customers` | Update a customer address |
@@ -120,6 +216,30 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `POST` | `/customers/bulk_add_tags` | `write_customers` | Bulk-add tags to customers |
| `POST` | `/customers/bulk_remove_tags` | `write_customers` | Bulk-remove tags from customers |
+## Delivery methods
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/delivery_methods` | `read_settings` | List delivery methods |
+| `POST` | `/delivery_methods` | `write_settings` | Create delivery method |
+| `GET` | `/delivery_methods/calculators` | `write_settings` | List delivery calculators |
+
+## Delivery profiles
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/delivery_profiles` | `read_settings` | List delivery profiles |
+| `POST` | `/delivery_profiles` | `write_settings` | Create a delivery profile |
+| `POST` | `/delivery_profiles/{delivery_profile_id}/origin_groups` | `write_settings` | Create an origin group |
+| `PATCH` | `/delivery_profiles/{id}` | `write_settings` | Update a delivery profile |
+| `DELETE` | `/delivery_profiles/{id}` | `write_settings` | Delete a delivery profile |
+
+## Delivery zones
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `POST` | `/delivery_zones` | `write_settings` | Create delivery zone |
+
## Exports
| Method | Path | Required scope | Summary |
@@ -148,14 +268,38 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `PATCH` | `/gift_cards/{id}` | `write_gift_cards` | Update a gift card |
| `DELETE` | `/gift_cards/{id}` | `write_gift_cards` | Delete a gift card |
+## Imports
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/imports` | *the write scope of the imported resource* | List imports |
+| `POST` | `/imports` | *the write scope of the imported resource* | Create an import |
+| `GET` | `/imports/template` | *the write scope of the imported resource* | Download an import template |
+| `GET` | `/imports/example` | *the write scope of the imported resource* | Download an example import file |
+| `GET` | `/imports/{id}` | *the write scope of the imported resource* | Show an import |
+| `DELETE` | `/imports/{id}` | *the write scope of the imported resource* | Delete an import |
+| `GET` | `/imports/{id}/download` | *the write scope of the imported resource* | Download the originally uploaded file |
+| `PATCH` | `/imports/{id}/complete_mapping` | *the write scope of the imported resource* | Complete mapping and start processing |
+| `PATCH` | `/imports/{id}/retry_failed_rows` | *the write scope of the imported resource* | Retry failed rows |
+| `GET` | `/imports/{import_id}/rows` | *the write scope of the imported resource* | List import rows |
+
+## Integrations
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/integrations` | `read_integrations` | List integrations |
+| `POST` | `/integrations` | `write_integrations` | Connect integration |
+| `GET` | `/integrations/types` | `read_integrations` | List integration types |
+| `POST` | `/integrations/{id}/test` | `write_integrations` | Test integration connection |
+
## Invitations
| Method | Path | Required scope | Summary |
|---|---|---|---|
-| `GET` | `/invitations` | `read_settings` | List invitations |
-| `POST` | `/invitations` | `write_settings` | Create an invitation |
-| `DELETE` | `/invitations/{id}` | `write_settings` | Revoke an invitation |
-| `PATCH` | `/invitations/{id}/resend` | `write_settings` | Resend an invitation |
+| `GET` | `/invitations` | `read_staff` | List invitations |
+| `POST` | `/invitations` | `write_staff` | Create an invitation |
+| `DELETE` | `/invitations/{id}` | `write_staff` | Revoke an invitation |
+| `PATCH` | `/invitations/{id}/resend` | `write_staff` | Resend an invitation |
## Locales
@@ -180,6 +324,14 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `GET` | `/me` | — | Get current admin user and permissions |
| `PATCH` | `/me` | — | Update the current admin profile |
+## Media
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/media` | `read_media` | List media |
+| `POST` | `/media` | `write_media` | Upload a file to the library |
+| `GET` | `/media/{id}/usage` | `read_media` | Where a file is used |
+
## Option types
| Method | Path | Required scope | Summary |
@@ -190,6 +342,22 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `PATCH` | `/option_types/{id}` | `write_products` | Update an option type |
| `DELETE` | `/option_types/{id}` | `write_products` | Delete an option type |
+## Order cancellation reasons
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/order_cancellation_reasons` | `read_settings` | List order cancellation reasons |
+| `POST` | `/order_cancellation_reasons` | `write_settings` | Create a order cancellation reason |
+| `GET` | `/order_cancellation_reasons/{id}` | `read_settings` | Get a order cancellation reason |
+| `PATCH` | `/order_cancellation_reasons/{id}` | `write_settings` | Update a order cancellation reason |
+| `DELETE` | `/order_cancellation_reasons/{id}` | `write_settings` | Delete a order cancellation reason |
+
+## Order routing rules
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/order_routing_rules/types` | `read_settings` | List available order routing rule types |
+
## Orders
| Method | Path | Required scope | Summary |
@@ -199,9 +367,13 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `GET` | `/orders/{order_id}/fulfillments/{id}` | `read_fulfillments` | Show a shipment |
| `PATCH` | `/orders/{order_id}/fulfillments/{id}` | `write_fulfillments` | Update a shipment |
| `PATCH` | `/orders/{order_id}/fulfillments/{id}/fulfill` | `write_fulfillments` | Fulfill a fulfillment |
+| `PATCH` | `/orders/{order_id}/fulfillments/{id}/mark_delivered` | `write_fulfillments` | Mark a fulfillment delivered |
| `PATCH` | `/orders/{order_id}/fulfillments/{id}/cancel` | `write_fulfillments` | Cancel a fulfillment |
-| `PATCH` | `/orders/{order_id}/fulfillments/{id}/resume` | `write_fulfillments` | Resume a fulfillment |
| `PATCH` | `/orders/{order_id}/fulfillments/{id}/split` | `write_fulfillments` | Split a fulfillment |
+| `GET` | `/orders/{order_id}/tax_lines` | `read_orders` | List tax lines |
+| `GET` | `/orders/{order_id}/discounts` | `read_orders` | List discounts |
+| `POST` | `/orders/{order_id}/discounts` | `write_orders` | Create manual discount |
+| `POST` | `/orders/{order_id}/fees` | `write_orders` | Create fee |
| `POST` | `/orders/{order_id}/gift_cards` | `write_gift_cards` | Apply a gift card to an order |
| `DELETE` | `/orders/{order_id}/gift_cards/{id}` | `write_gift_cards` | Remove a gift card from an order |
| `GET` | `/orders/{order_id}/items` | `read_orders` | List order items |
@@ -219,7 +391,6 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `PATCH` | `/orders/{id}/complete` | `write_orders` | Complete an order |
| `PATCH` | `/orders/{id}/cancel` | `write_orders` | Cancel an order |
| `PATCH` | `/orders/{id}/approve` | `write_orders` | Approve an order |
-| `PATCH` | `/orders/{id}/resume` | `write_orders` | Resume a canceled order |
| `POST` | `/orders/{id}/resend_confirmation` | `write_orders` | Resend confirmation email |
| `GET` | `/orders/{order_id}/payments` | `read_payments` | List payments |
| `POST` | `/orders/{order_id}/payments` | `write_payments` | Create a payment |
@@ -228,6 +399,26 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `PATCH` | `/orders/{order_id}/payments/{id}/void` | `write_payments` | Void a payment |
| `GET` | `/orders/{order_id}/refunds` | `read_refunds` | List refunds |
| `POST` | `/orders/{order_id}/refunds` | `write_refunds` | Create a refund |
+| `GET` | `/orders/{order_id}/fulfillments/{fulfillment_id}/deliveries` | `read_fulfillments` | List deliveries |
+| `POST` | `/orders/{order_id}/fulfillments/{fulfillment_id}/deliveries` | `write_fulfillments` | Record a delivery |
+| `PATCH` | `/orders/{order_id}/fulfillments/{fulfillment_id}/deliveries/{id}` | `write_fulfillments` | Correct a delivery |
+| `DELETE` | `/orders/{order_id}/fulfillments/{fulfillment_id}/deliveries/{id}` | `write_fulfillments` | Delete a delivery |
+| `PATCH` | `/orders/{order_id}/fulfillments/{fulfillment_id}/deliveries/{id}/mark_delivered` | `write_fulfillments` | Mark a delivery delivered |
+| `GET` | `/orders/{order_id}/fulfillments/{fulfillment_id}/labels` | `read_fulfillments` | List shipping labels |
+| `POST` | `/orders/{order_id}/fulfillments/{fulfillment_id}/labels` | `write_fulfillments` | Buy or record a shipping label |
+| `GET` | `/orders/{order_id}/fulfillments/{fulfillment_id}/labels/{id}` | `read_fulfillments` | Get a shipping label |
+| `DELETE` | `/orders/{order_id}/fulfillments/{fulfillment_id}/labels/{id}` | `write_fulfillments` | Delete an uploaded label |
+| `PATCH` | `/orders/{order_id}/fulfillments/{fulfillment_id}/labels/{id}/refund` | `write_fulfillments` | Refund a shipping label |
+
+## Package types
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/package_types` | `read_package_types` | List package types |
+| `POST` | `/package_types` | `write_package_types` | Create a package type |
+| `GET` | `/package_types/{id}` | `read_package_types` | Get a package type |
+| `PATCH` | `/package_types/{id}` | `write_package_types` | Update a package type |
+| `DELETE` | `/package_types/{id}` | `write_package_types` | Delete a package type |
## Payment methods
@@ -237,6 +428,22 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `GET` | `/payment_methods/types` | `read_settings` | List available payment provider types |
| `GET` | `/payment_methods/{id}` | `read_settings` | Show a payment method |
+## Permissions
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/permissions` | — | List the permission catalog |
+
+## Policies
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/policies` | `read_settings` | List policies |
+| `POST` | `/policies` | `write_settings` | Create a policy |
+| `GET` | `/policies/{id}` | `read_settings` | Get a policy |
+| `PATCH` | `/policies/{id}` | `write_settings` | Update a policy |
+| `DELETE` | `/policies/{id}` | `write_settings` | Delete a policy |
+
## Price lists
| Method | Path | Required scope | Summary |
@@ -248,6 +455,9 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `DELETE` | `/price_lists/{id}` | `write_products` | Delete a price list |
| `PATCH` | `/price_lists/{id}/activate` | `write_products` | Activate a price list |
| `PATCH` | `/price_lists/{id}/deactivate` | `write_products` | Deactivate a price list |
+| `GET` | `/price_lists/{price_list_id}/products` | `read_products` | List price list products |
+| `POST` | `/price_lists/{price_list_id}/products` | `write_products` | Add products to a price list |
+| `DELETE` | `/price_lists/{price_list_id}/products` | `write_products` | Remove products from a price list |
## Prices
@@ -261,6 +471,17 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `POST` | `/prices/bulk_upsert` | `write_products` | Bulk-upsert prices |
| `DELETE` | `/prices/bulk_destroy` | `write_products` | Bulk-delete prices |
+## Product types
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/product_types` | `read_products` | List product types |
+| `POST` | `/product_types` | `write_products` | Create a product type |
+| `GET` | `/product_types/{id}` | `read_products` | Retrieve a product type |
+| `PATCH` | `/product_types/{id}` | `write_products` | Update a product type |
+| `DELETE` | `/product_types/{id}` | `write_products` | Delete a product type |
+| `POST` | `/product_types/{id}/apply_to_products` | `write_products` | Apply a product type to its existing products |
+
## Products
| Method | Path | Required scope | Summary |
@@ -279,6 +500,8 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `POST` | `/products/bulk_status_update` | `write_products` | Bulk-update product status |
| `POST` | `/products/bulk_add_to_categories` | `write_products` | Bulk-add products to categories |
| `POST` | `/products/bulk_remove_from_categories` | `write_products` | Bulk-remove products from categories |
+| `POST` | `/products/bulk_add_to_collections` | `write_products` | Bulk-add products to collections |
+| `POST` | `/products/bulk_remove_from_collections` | `write_products` | Bulk-remove products from collections |
| `POST` | `/products/bulk_add_to_channels` | `write_products` | Bulk-add products to channels |
| `POST` | `/products/bulk_remove_from_channels` | `write_products` | Bulk-remove products from channels |
| `POST` | `/products/bulk_add_tags` | `write_products` | Bulk-add tags to products |
@@ -289,6 +512,7 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `GET` | `/products/{product_id}/variants/{id}` | `read_products` | Get a variant |
| `PATCH` | `/products/{product_id}/variants/{id}` | `write_products` | Update a variant |
| `DELETE` | `/products/{product_id}/variants/{id}` | `write_products` | Delete a variant |
+| `POST` | `/products/{product_id}/media` | `write_products` | Place a library file on a product |
## Promotion actions
@@ -320,11 +544,87 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `PATCH` | `/promotions/{id}` | `write_promotions` | Update a promotion |
| `DELETE` | `/promotions/{id}` | `write_promotions` | Delete a promotion |
+## Purchase orders
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/purchase_orders` | `read_purchasing` | List purchase orders |
+| `POST` | `/purchase_orders` | `write_purchasing` | Create a purchase order |
+| `GET` | `/purchase_orders/{id}` | `read_purchasing` | Get a purchase order |
+| `PATCH` | `/purchase_orders/{id}/mark_ordered` | `write_purchasing` | Place the order with the supplier |
+| `GET` | `/purchase_orders/{purchase_order_id}/stock_receipts` | `read_purchasing` | List the deliveries booked against an order |
+| `POST` | `/purchase_orders/{purchase_order_id}/stock_receipts` | `write_purchasing` | Book in a delivery |
+| `PATCH` | `/purchase_orders/{id}/mark_draft` | `write_purchasing` | Take an order back to draft |
+| `PATCH` | `/purchase_orders/{id}/close` | `write_purchasing` | Close an order short |
+| `PATCH` | `/purchase_orders/{id}/cancel` | `write_purchasing` | Cancel a purchase order |
+
+## Refund reasons
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/refund_reasons` | `read_settings` | List refund reasons |
+| `POST` | `/refund_reasons` | `write_settings` | Create a refund reason |
+| `GET` | `/refund_reasons/{id}` | `read_settings` | Get a refund reason |
+| `PATCH` | `/refund_reasons/{id}` | `write_settings` | Update a refund reason |
+| `DELETE` | `/refund_reasons/{id}` | `write_settings` | Delete a refund reason |
+
+## Return reasons
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/return_reasons` | `read_settings` | List return reasons |
+| `POST` | `/return_reasons` | `write_settings` | Create a return reason |
+| `GET` | `/return_reasons/{id}` | `read_settings` | Get a return reason |
+| `PATCH` | `/return_reasons/{id}` | `write_settings` | Update a return reason |
+| `DELETE` | `/return_reasons/{id}` | `write_settings` | Delete a return reason |
+
## Roles
| Method | Path | Required scope | Summary |
|---|---|---|---|
-| `GET` | `/roles` | `read_settings` | List roles |
+| `GET` | `/roles` | `read_staff` | List roles |
+| `POST` | `/roles` | `write_staff` | Create a role |
+| `PATCH` | `/roles/{id}` | `write_staff` | Update a role |
+| `DELETE` | `/roles/{id}` | `write_staff` | Delete a role |
+
+## Seller payouts
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `PATCH` | `/seller_payouts/{id}/complete` | `write_payouts` | Mark a payout paid |
+
+## Seller requirements
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/seller_requirements` | `read_sellers` | List seller requirements |
+| `POST` | `/seller_requirements` | `write_sellers` | Add a seller requirement |
+| `GET` | `/seller_requirements/types` | `read_sellers` | List seller requirement kinds |
+| `PATCH` | `/seller_requirements/{id}` | `write_sellers` | Update a seller requirement |
+| `DELETE` | `/seller_requirements/{id}` | `write_sellers` | Delete a seller requirement |
+
+## Sellers
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/sellers` | `read_sellers` | List sellers |
+| `POST` | `/sellers` | `write_sellers` | Create a seller |
+| `GET` | `/sellers/{id}` | `read_sellers` | Get a seller |
+| `PATCH` | `/sellers/{id}` | `write_sellers` | Update a seller |
+| `DELETE` | `/sellers/{id}` | `write_sellers` | Delete a seller |
+| `POST` | `/sellers/{id}/invite` | `write_sellers` | Invite someone to run a seller |
+| `PATCH` | `/sellers/{id}/approve` | `write_sellers` | Approve a seller |
+| `PATCH` | `/sellers/{id}/suspend` | `write_sellers` | Suspend a seller |
+| `PATCH` | `/sellers/{id}/reject` | `write_sellers` | Reject a seller |
+| `GET` | `/sellers/{seller_id}/balances` | `read_payouts` | List a seller's balances |
+| `POST` | `/sellers/{seller_id}/payouts` | `write_payouts` | Settle a seller |
+
+## Stock levels
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/stock_levels` | `read_stock` | List stock levels |
+| `POST` | `/stock_levels/bulk_upsert` | `write_stock` | Bulk-upsert stock levels |
## Stock locations
@@ -336,6 +636,29 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `PATCH` | `/stock_locations/{id}` | `write_stock` | Update a stock location |
| `DELETE` | `/stock_locations/{id}` | `write_stock` | Delete a stock location |
+## Stock movements
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/stock_movements` | `read_stock` | List stock movements |
+| `GET` | `/stock_movements/{id}` | `read_stock` | Get a stock movement |
+
+## Stock transfers
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/stock_transfers` | `read_stock` | List stock transfers |
+| `POST` | `/stock_transfers` | `write_stock` | Create a stock transfer |
+| `GET` | `/stock_transfers/{id}` | `read_stock` | Get a stock transfer |
+| `DELETE` | `/stock_transfers/{id}` | `write_stock` | Delete a stock transfer |
+| `PATCH` | `/stock_transfers/{id}/mark_ready` | `write_stock` | Mark a transfer ready to ship |
+| `PATCH` | `/stock_transfers/{id}/mark_in_transit` | `write_stock` | Send a transfer |
+| `GET` | `/stock_transfers/{stock_transfer_id}/stock_receipts` | `read_stock` | List the deliveries counted in against a transfer |
+| `POST` | `/stock_transfers/{stock_transfer_id}/stock_receipts` | `write_stock` | Count a delivery in |
+| `PATCH` | `/stock_transfers/{id}/mark_draft` | `write_stock` | Take a transfer back to draft |
+| `PATCH` | `/stock_transfers/{id}/close` | `write_stock` | Close a transfer short |
+| `PATCH` | `/stock_transfers/{id}/cancel` | `write_stock` | Cancel a stock transfer |
+
## Store
| Method | Path | Required scope | Summary |
@@ -343,12 +666,40 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| `GET` | `/store` | `read_settings` | Get the current store |
| `PATCH` | `/store` | `write_settings` | Update the current store |
+## Store credits
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/store_credits` | `read_store_credits` | List store credits |
+| `GET` | `/store_credits/{id}` | `read_store_credits` | Retrieve a store credit |
+| `GET` | `/store_credits/{store_credit_id}/events` | `read_store_credits` | List a store credit's ledger |
+
+## Suppliers
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/suppliers` | `read_purchasing` | List suppliers |
+| `POST` | `/suppliers` | `write_purchasing` | Create a supplier |
+| `GET` | `/suppliers/{id}` | `read_purchasing` | Get a supplier |
+| `PATCH` | `/suppliers/{id}` | `write_purchasing` | Update a supplier |
+| `DELETE` | `/suppliers/{id}` | `write_purchasing` | Delete a supplier |
+
## Tags
| Method | Path | Required scope | Summary |
|---|---|---|---|
| `GET` | `/tags` | — | List tags |
+## Tax rates
+
+| Method | Path | Required scope | Summary |
+|---|---|---|---|
+| `GET` | `/tax_rates` | `read_settings` | List tax rates |
+| `POST` | `/tax_rates` | `write_settings` | Create a tax rate |
+| `GET` | `/tax_rates/{id}` | `read_settings` | Get a tax rate |
+| `PATCH` | `/tax_rates/{id}` | `write_settings` | Update a tax rate |
+| `DELETE` | `/tax_rates/{id}` | `write_settings` | Delete a tax rate |
+
## Translatable resources
| Method | Path | Required scope | Summary |
@@ -359,7 +710,8 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| Method | Path | Required scope | Summary |
|---|---|---|---|
-| `POST` | `/translations/batch` | `write_*` (eg. `write_products`) for every resource type in the batch (for API-key authentication) | Batch upsert translations |
+| `GET` | `/translations` | `read_products` | Translation coverage for a resource type |
+| `POST` | `/translations/batch` | *write_<resource> for every resource type in the batch (for API-key authentication)* | Batch upsert translations |
## Webhook endpoints
diff --git a/docs/api-reference/admin-api/errors.mdx b/docs/api-reference/admin-api/errors.mdx
index ff2c710a97..9055602ffb 100644
--- a/docs/api-reference/admin-api/errors.mdx
+++ b/docs/api-reference/admin-api/errors.mdx
@@ -63,7 +63,7 @@ Some specialized errors carry structured `details` (for example, scope errors in
|---|---|---|
| `400` | Bad Request | Missing required parameters, malformed JSON |
| `401` | Unauthorized | Missing or invalid API key, expired or invalid JWT token |
-| `403` | Forbidden | Authenticated but lacks permission (CanCanCan ability) or scope |
+| `403` | Forbidden | Authenticated but lacks a scope (API key) or role permission (JWT) |
| `404` | Not Found | Resource doesn't exist, isn't accessible to the calling key, or belongs to a different store |
| `409` | Conflict | Resource was modified by a concurrent request (optimistic locking) |
| `422` | Unprocessable Content | Validation failed, invalid state transition, business rule violation |
@@ -77,7 +77,7 @@ Some specialized errors carry structured `details` (for example, scope errors in
| `authentication_failed` | 401 | Login email/password was wrong |
| `invalid_token` | 401 | API key or JWT token is invalid or expired |
| `invalid_refresh_token` | 401 | Refresh token is invalid or expired |
-| `access_denied` | 403 | Caller lacks permission. For API-key callers, `details.required_scope` indicates the missing scope (see [Authentication](/api-reference/admin-api/authentication#permissions)). For JWT callers, the user's role lacks the CanCanCan ability for this action. |
+| `access_denied` | 403 | Caller lacks permission. For API-key callers, `details.required_scope` indicates the missing scope (see [Authentication](/api-reference/admin-api/authentication#permissions)). For JWT callers, `details.required_permission` names the permission key the user's role is missing; a denial without it is a record-level rule. |
| `current_password_invalid` | 422 | Current password is wrong (when changing password) |
## Resources
diff --git a/docs/api-reference/admin-api/introduction.mdx b/docs/api-reference/admin-api/introduction.mdx
index d0ee568b5f..ffcad6ba57 100644
--- a/docs/api-reference/admin-api/introduction.mdx
+++ b/docs/api-reference/admin-api/introduction.mdx
@@ -19,7 +19,7 @@ All routes are prefixed with `/api/v3/admin`. During development the API is avai
| **Purpose** | Manage store data | Power storefronts |
| **Audience** | Staff users, backend integrations | Customers, storefronts |
| **Authentication** | Secret API key (`sk_…`) or admin JWT | Publishable API key (`pk_…`), customer JWT, order token |
-| **Permissions** | API key scopes (API key authentication) or Admin Staff permission sets | Customer can only read/modify their own data |
+| **Permissions** | API key scopes (API key authentication) or the staff member's role permissions — the same `read_*`/`write_*` keys | Customer can only read/modify their own data |
| **Write operations** | Full CRUD on most resources | Limited to the current customer's cart, addresses, profile |
If you're building a storefront, use the [Store API](/api-reference/store-api/introduction). The Admin API exposes administrative operations that should never be invoked from a browser.
@@ -49,7 +49,7 @@ const client = createAdminClient({
})
const { data: orders } = await client.orders.list({
- status_eq: 'complete',
+ status_eq: 'placed',
limit: 25,
})
```
@@ -59,7 +59,7 @@ const { data: orders } = await client.orders.list({
Every endpoint can also be called with the [Spree CLI](/developer/cli/admin-api) — a generic HTTP client (`get`/`post`/`patch`/`delete`) built into `@spree/cli`. It's the fastest way to explore the API from a terminal or drive it from scripts and AI agents, with zero-config credentials in local development:
```bash
-spree api get /orders -q status_eq=complete --limit 25
+spree api get /orders -q status_eq=placed --limit 25
```
Each endpoint page below shows the matching **Spree CLI** command alongside the SDK example. To browse the whole surface offline, use `spree api endpoints` and `spree api schema "<METHOD> <path>"`.
diff --git a/docs/api-reference/admin-api/querying.mdx b/docs/api-reference/admin-api/querying.mdx
index 33fe09be1d..55ffb323f3 100644
--- a/docs/api-reference/admin-api/querying.mdx
+++ b/docs/api-reference/admin-api/querying.mdx
@@ -14,7 +14,7 @@ Pass filter conditions via `q`:
```typescript SDK
const orders = await client.orders.list({
- status_eq: 'complete',
+ status_eq: 'placed',
total_gteq: 100,
email_cont: '@example.com',
})
@@ -23,7 +23,7 @@ const orders = await client.orders.list({
```bash cURL
curl -G 'https://store.example.com/api/v3/admin/orders' \
-H 'X-Spree-Api-Key: sk_xxx' \
- --data-urlencode 'q[status_eq]=complete' \
+ --data-urlencode 'q[status_eq]=placed' \
--data-urlencode 'q[total_gteq]=100' \
--data-urlencode 'q[email_cont][email protected]'
```
@@ -38,7 +38,7 @@ The SDK automatically wraps filter keys in `q[...]` and appends `[]` for array v
| Predicate | Description | SDK | cURL |
|---|---|---|---|
-| `eq` | Equals | `status_eq: 'complete'` | `q[status_eq]=complete` |
+| `eq` | Equals | `status_eq: 'placed'` | `q[status_eq]=placed` |
| `not_eq` | Not equals | `status_not_eq: 'canceled'` | `q[status_not_eq]=canceled` |
| `cont` | Contains (case-insensitive) | `email_cont: '@acme'` | `q[email_cont]=@acme` |
| `start` | Starts with | `number_start: 'R10'` | `q[number_start]=R10` |
@@ -79,9 +79,9 @@ Multiple filters combine with AND:
<CodeGroup>
```typescript SDK
-// Completed orders over $100 from the last 7 days
+// Placed orders over $100 from the last 7 days
const orders = await client.orders.list({
- status_eq: 'complete',
+ status_eq: 'placed',
total_gteq: 100,
completed_at_gteq: new Date(Date.now() - 7 * 86_400_000).toISOString(),
})
@@ -90,7 +90,7 @@ const orders = await client.orders.list({
```bash cURL
curl -G 'https://store.example.com/api/v3/admin/orders' \
-H 'X-Spree-Api-Key: sk_xxx' \
- --data-urlencode 'q[status_eq]=complete' \
+ --data-urlencode 'q[status_eq]=placed' \
--data-urlencode 'q[total_gteq]=100' \
--data-urlencode 'q[completed_at_gteq]=2026-04-22T00:00:00Z'
```
diff --git a/docs/api-reference/store-api/monetary-amounts.mdx b/docs/api-reference/store-api/monetary-amounts.mdx
index be5a92748e..405df72766 100644
--- a/docs/api-reference/store-api/monetary-amounts.mdx
+++ b/docs/api-reference/store-api/monetary-amounts.mdx
@@ -16,8 +16,8 @@ Every monetary field has a corresponding `display_` field that includes currency
"display_total": "$129.99",
"item_total": "99.99",
"display_item_total": "$99.99",
- "ship_total": "10.00",
- "display_ship_total": "$10.00",
+ "delivery_total": "10.00",
+ "display_delivery_total": "$10.00",
"tax_total": "20.00",
"display_tax_total": "$20.00"
}
@@ -29,9 +29,9 @@ This convention applies to all monetary fields across all resources:
| Resource | Monetary Fields |
|----------|----------------|
-| **Order** | `total`, `item_total`, `ship_total`, `tax_total`, `adjustment_total`, `promo_total`, `included_tax_total`, `additional_tax_total` |
-| **Line Item** | `price`, `total`, `adjustment_total`, `promo_total`, `pre_tax_amount`, `discounted_amount`, `compare_at_amount` |
-| **Shipment** | `cost` |
+| **Cart / Order** | `total`, `item_total`, `delivery_total`, `tax_total`, `adjustment_total`, `discount_total`, `included_tax_total`, `additional_tax_total`, `fee_total`, `store_credit_total`, `gift_card_total`, `amount_due` |
+| **Line Item** | `price`, `total`, `adjustment_total`, `discount_total`, `included_tax_total`, `additional_tax_total`, `pre_tax_amount`, `discounted_amount`, `compare_at_amount` |
+| **Fulfillment** | `cost` |
| **Payment** | `amount` |
| **Gift Card** | `amount`, `amount_used`, `amount_authorized`, `amount_remaining` |
| **Store Credit** | `amount`, `amount_used`, `amount_remaining` |
diff --git a/docs/api-reference/webhooks-events.mdx b/docs/api-reference/webhooks-events.mdx
index 045883861e..37948dcad9 100644
--- a/docs/api-reference/webhooks-events.mdx
+++ b/docs/api-reference/webhooks-events.mdx
@@ -8,11 +8,11 @@ Every webhook delivery sends a JSON envelope with the event metadata and a `data
```json
{
"id": "550e8400-e29b-41d4-a716-446655440000",
- "name": "order.completed",
+ "name": "order.placed",
"created_at": "2025-01-15T10:30:00Z",
"data": { ... },
"metadata": {
- "spree_version": "5.4.0"
+ "spree_version": "6.0.0"
}
}
```
@@ -20,75 +20,121 @@ Every webhook delivery sends a JSON envelope with the event metadata and a `data
| Field | Type | Description |
|-------|------|-------------|
| `id` | string | Unique UUID for this event |
-| `name` | string | Event name (e.g., `order.completed`) |
+| `name` | string | Event name (e.g., `order.placed`) |
| `created_at` | string | ISO 8601 timestamp |
| `data` | object | Serialized resource (see payloads below) |
-| `metadata` | object | Additional context including Spree version |
+| `metadata` | object | Additional context: always the Spree version, plus event-specific keys such as `notify_customer` (fulfillment events — order events carry it in `data`) or `deprecated_alias_of` |
Event payloads use the same [Store API V3 serializers](/api-reference/introduction) as the REST API. All `id` fields use [prefixed IDs](/api-reference/introduction) (e.g., `or_m3Rp9wXz`, `prod_86Rf07xd4z`). All monetary values are strings. All timestamps are ISO 8601.
-For details on creating webhook endpoints and verifying signatures, see [Webhooks](/developer/core-concepts/webhooks). For the event system internals and subscriber pattern, see [Events](/developer/core-concepts/events).
+For details on creating webhook endpoints and verifying signatures, see [Webhooks](/developer/core-concepts/webhooks). For the event system and the subscriber pattern, see [Events](/developer/core-concepts/events).
<Info>
-Event payloads include the same top-level attributes and unconditional associations as API responses. Conditional associations (like product variants, media, or custom fields) are not included in event payloads.
+Event payloads include the same top-level attributes and unconditional associations as API responses. Associations that the API only returns when you ask for them with `expand` (like product variants, media, or custom fields) are not included in event payloads.
</Info>
+## Renamed events
+
+Spree 6.0 renamed several events. For one release, Spree sends the old name as well as the new one, so existing endpoints keep receiving deliveries. The old names stop in Spree 6.1 — subscribe to the new names.
+
+| Old name (sent until 6.1) | New name |
+|---|---|
+| `order.completed` | `order.placed` |
+| `order.shipped` | `order.fulfilled` |
+| `shipment.shipped` | `fulfillment.fulfilled` |
+| `shipment.canceled` | `fulfillment.canceled` |
+| `stock_item.created` / `.updated` / `.deleted` | `stock_level.created` / `.updated` / `.deleted` |
+| `wished_item.created` / `.updated` / `.deleted` | `wishlist_item.created` / `.updated` / `.deleted` |
+| `digital.created` / `.updated` / `.deleted` | `digital_asset.created` / `.updated` / `.deleted` |
+
+An `order.completed` delivery carries `"deprecated_alias_of": "order.placed"` in its `metadata`, so an endpoint subscribed to `order.*` can skip the duplicate.
+
+These events were removed in Spree 6.0 and are no longer sent:
+
+- `order.resumed` and `fulfillment.resumed` — a canceled order or fulfillment can no longer be resumed.
+- `shipment.created` and `shipment.updated` — use `fulfillment.created` and `fulfillment.updated`.
+- `image.*` — use `media.*`.
+- `report.*` — use `saved_report.*`.
+- `reimbursement.*`, `return_authorization.*`, `return_item.*` and `customer_return.*` — use the `return.*`, `exchange.*` and `claim.*` events.
+- `post.*` and `post_category.*`.
+
---
## Order Events
-Events: `order.created`, `order.updated`, `order.completed`, `order.canceled`, `order.paid`, `order.shipped`
+Events: `order.created`, `order.updated`, `order.deleted`, `order.placed`, `order.approved`, `order.canceled`, `order.paid`, `order.fulfilled`, `order.delivered`, `order.resend_confirmation_email`, `order.resend_digital_links_email`
+
+| Event | When it fires |
+|---|---|
+| `order.placed` | A customer completed checkout, or an admin placed a draft order |
+| `order.approved` | An admin approved an order that was flagged as risky |
+| `order.canceled` | The order was canceled |
+| `order.paid` | Payments cover the order total in full |
+| `order.fulfilled` | Every fulfillment on the order was handed over to the customer or carrier |
+| `order.delivered` | Every fulfillment on the order was delivered |
+| `order.resend_confirmation_email` | An admin asked to send the order confirmation again |
+| `order.resend_digital_links_email` | An admin asked to send the download links again |
+
+The `order.placed` and `order.canceled` payloads also contain a `notify_customer` boolean. It is `false` when whoever placed or canceled the order asked for the customer not to be emailed.
-Order payloads include nested `items`, `fulfillments` (the Store API name for shipments), `payments`, `billing_address`, `shipping_address`, `payment_methods`, and `discounts`.
+Order payloads include nested `items`, `fulfillments`, `payments`, `discounts`, `fees`, `billing_address`, `shipping_address`, `gift_card`, and `market`.
```json
{
"id": "or_m3Rp9wXz",
+ "cart_id": "cart_k5nR8xLq",
"number": "R123456789",
- "state": "complete",
- "token": "abc123def456",
"email": "[email protected]",
- "special_instructions": null,
+ "customer_note": null,
+ "po_number": null,
"currency": "USD",
- "item_count": 3,
- "fulfillment_status": "shipped",
- "payment_state": "paid",
+ "locale": "en",
+ "total_quantity": 3,
+ "coupon_code": null,
+ "fulfillment_status": "fulfilled",
+ "payment_status": "paid",
+ "market_id": "mkt_2wMn9xPq",
+ "channel_id": "ch_3xLq8nRt",
+ "company_id": null,
+ "company_name": null,
"item_total": "89.99",
"display_item_total": "$89.99",
"delivery_total": "10.00",
"display_delivery_total": "$10.00",
"adjustment_total": "0.00",
"display_adjustment_total": "$0.00",
- "promo_total": "0.00",
- "display_promo_total": "$0.00",
+ "discount_total": "0.00",
+ "display_discount_total": "$0.00",
"tax_total": "0.00",
"display_tax_total": "$0.00",
"included_tax_total": "0.00",
"display_included_tax_total": "$0.00",
"additional_tax_total": "0.00",
"display_additional_tax_total": "$0.00",
+ "fee_total": "0.00",
+ "display_fee_total": "$0.00",
+ "store_credit_total": "0.00",
+ "display_store_credit_total": "$0.00",
+ "gift_card_total": "0.00",
+ "display_gift_card_total": "$0.00",
+ "covered_by_store_credit": false,
"total": "99.99",
"display_total": "$99.99",
+ "amount_due": "0.00",
+ "display_amount_due": "$0.00",
"completed_at": "2025-01-15T10:30:00Z",
- "created_at": "2025-01-15T10:00:00Z",
- "updated_at": "2025-01-15T10:30:00Z",
- "promotions": [],
+ "withdrawal_period_ends_at": null,
+ "within_withdrawal_period": false,
+ "discounts": [],
+ "fees": [],
"items": [
{
"id": "li_7xRt4wPq",
- "variant_id": "var_k5nR8xLq",
+ "variant_id": "variant_k5nR8xLq",
"quantity": 2,
- "currency": "USD",
"name": "Spree Tote Bag",
- "slug": "spree-tote-bag",
- "options_text": "Size: M, Color: Black",
"price": "29.99",
- "display_price": "$29.99",
"total": "59.98",
- "display_total": "$59.98",
- "thumbnail_url": "https://cdn.example.com/images/tote-bag.jpg",
- "option_values": [],
- "digital_links": [],
"..."
}
],
@@ -96,49 +142,39 @@ Order payloads include nested `items`, `fulfillments` (the Store API name for sh
{
"id": "ful_9xPq4wMn",
"number": "H123456789",
- "status": "shipped",
+ "status": "fulfilled",
"fulfillment_type": "shipping",
"tracking": "1Z999AA10123456784",
- "tracking_url": "https://tools.usps.com/go/TrackConfirmAction?tLabels=1Z999AA10123456784",
- "cost": "10.00",
- "display_cost": "$10.00",
- "fulfilled_at": "2025-01-16T14:00:00Z",
- "delivery_method": { "id": "dm_2wMn7xRt", "..." },
- "stock_location": { "id": "sl_2wMn7xRt", "..." },
- "delivery_rates": [],
"..."
}
],
"payments": [
{
- "id": "pay_3wXz7mRp",
- "state": "completed",
- "number": "P123456",
+ "id": "py_3wXz7mRp",
+ "status": "completed",
"amount": "99.99",
- "display_amount": "$99.99",
- "response_code": "ch_abc123",
- "payment_method_id": "pm_4xLq8nRt",
- "source_type": "credit_card",
- "source_id": "cc_5wPq9mXz",
- "source": { "..." },
- "payment_method": { "id": "pm_4xLq8nRt", "..." },
"..."
}
],
- "bill_address": {
- "id": "addr_1xPq2wMn",
- "..."
- },
- "ship_address": {
- "id": "addr_2wMn3xPq",
- "..."
- },
- "payment_methods": [
- { "id": "pm_4xLq8nRt", "..." }
- ]
+ "billing_address": { "id": "addr_1xPq2wMn", "..." },
+ "shipping_address": { "id": "addr_2wMn3xPq", "..." },
+ "gift_card": null,
+ "market": { "id": "mkt_2wMn9xPq", "..." }
}
```
+## Cart Events
+
+Events: `cart.created`, `cart.updated`, `cart.deleted`
+
+Carts publish their own events, separate from orders. Use them to follow carts that were never checked out. The payload is the same cart object the [Store API](/api-reference/store-api/introduction) returns. When a cart is checked out, the resulting order carries the cart's ID in its `cart_id` field.
+
+## Order Group Events
+
+Events: `order_group.created`, `order_group.updated`, `order_group.deleted`, `order_group.completed`
+
+When one checkout creates several orders (for example, one per seller), they belong to an order group. `order_group.completed` fires once every order in the group is placed. The payload includes the group's `number`, `email`, `currency`, `total`, `item_total`, `fulfillment_status`, `payment_status`, `completed_at`, the addresses, and the nested `orders`.
+
## Line Item Events
Events: `line_item.created`, `line_item.updated`, `line_item.deleted`
@@ -148,12 +184,15 @@ Line item payloads include nested `option_values` and `digital_links`.
```json
{
"id": "li_7xRt4wPq",
- "variant_id": "var_k5nR8xLq",
+ "variant_id": "variant_k5nR8xLq",
+ "seller_id": null,
"quantity": 2,
"currency": "USD",
"name": "Spree Tote Bag",
"slug": "spree-tote-bag",
"options_text": "Size: M, Color: Black",
+ "preorder": false,
+ "preorder_ships_at": null,
"price": "29.99",
"display_price": "$29.99",
"total": "59.98",
@@ -164,8 +203,8 @@ Line item payloads include nested `option_values` and `digital_links`.
"display_additional_tax_total": "$2.40",
"included_tax_total": "0.00",
"display_included_tax_total": "$0.00",
- "promo_total": "-5.00",
- "display_promo_total": "-$5.00",
+ "discount_total": "-5.00",
+ "display_discount_total": "-$5.00",
"pre_tax_amount": "54.98",
"display_pre_tax_amount": "$54.98",
"discounted_amount": "54.98",
@@ -173,10 +212,8 @@ Line item payloads include nested `option_values` and `digital_links`.
"compare_at_amount": null,
"display_compare_at_amount": null,
"thumbnail_url": "https://cdn.example.com/images/tote-bag.jpg",
- "created_at": "2025-01-15T10:00:00Z",
- "updated_at": "2025-01-15T10:00:00Z",
"option_values": [
- { "id": "ov_2wMn9xPq", "name": "M", "presentation": "Medium" }
+ { "id": "optval_2wMn9xPq", "name": "m", "label": "M", "..." }
],
"digital_links": []
}
@@ -184,41 +221,39 @@ Line item payloads include nested `option_values` and `digital_links`.
## Payment Events
-Events: `payment.created`, `payment.updated`, `payment.paid`
+Events: `payment.created`, `payment.updated`, `payment.deleted`, `payment.completed`, `payment.paid`, `payment.captured`, `payment.voided`, `payment.refunded`
-Payment payloads include a nested `payment_method` and polymorphic `source` (credit card, store credit, or payment source).
+Payment payloads include a nested `payment_method` and a `source` (a credit card, store credit, or other payment source).
```json
{
- "id": "pay_3wXz7mRp",
- "state": "completed",
+ "id": "py_3wXz7mRp",
+ "status": "completed",
"number": "P123456",
"amount": "99.99",
"display_amount": "$99.99",
"response_code": "ch_abc123",
"payment_method_id": "pm_4xLq8nRt",
"source_type": "credit_card",
- "source_id": "cc_5wPq9mXz",
+ "source_id": "card_5wPq9mXz",
"source": {
- "id": "cc_5wPq9mXz",
+ "id": "card_5wPq9mXz",
"..."
},
"payment_method": {
"id": "pm_4xLq8nRt",
"..."
- },
- "created_at": "2025-01-15T10:25:00Z",
- "updated_at": "2025-01-15T10:25:00Z"
+ }
}
```
-The `source_type` field is normalized to one of: `"credit_card"`, `"store_credit"`, `"payment_source"`, or `null`.
+The `source_type` field is one of: `"credit_card"`, `"store_credit"`, `"payment_source"`, or `null`.
## Payment Session Events
-Events: `payment_session.created`, `payment_session.updated`, `payment_session.deleted`
+Events: `payment_session.created`, `payment_session.updated`, `payment_session.deleted`, `payment_session.processing`, `payment_session.completed`, `payment_session.failed`, `payment_session.canceled`, `payment_session.expired`
-Payment session payloads include a nested `payment_method` and optionally a nested `payment`.
+Payment session payloads include a nested `payment_method`, and a nested `payment` once one exists.
```json
{
@@ -229,21 +264,20 @@ Payment session payloads include a nested `payment_method` and optionally a nest
"external_id": "pi_3abc123",
"external_data": {},
"customer_external_id": null,
- "order_id": "or_m3Rp9wXz",
+ "order_id": null,
+ "cart_id": "cart_k5nR8xLq",
"payment_method_id": "pm_4xLq8nRt",
"payment_method": {
"id": "pm_4xLq8nRt",
"..."
},
- "expires_at": "2025-01-15T11:00:00Z",
- "created_at": "2025-01-15T10:25:00Z",
- "updated_at": "2025-01-15T10:25:00Z"
+ "expires_at": "2025-01-15T11:00:00Z"
}
```
## Payment Setup Session Events
-Events: `payment_setup_session.created`, `payment_setup_session.updated`, `payment_setup_session.deleted`
+Events: `payment_setup_session.created`, `payment_setup_session.updated`, `payment_setup_session.deleted`, `payment_setup_session.processing`, `payment_setup_session.completed`, `payment_setup_session.failed`, `payment_setup_session.canceled`, `payment_setup_session.expired`
Payment setup session payloads include a nested `payment_method`.
@@ -255,43 +289,75 @@ Payment setup session payloads include a nested `payment_method`.
"external_client_secret": "seti_abc123_secret_xyz",
"external_data": {},
"payment_method_id": "pm_4xLq8nRt",
- "payment_source_id": "cc_5wPq9mXz",
- "payment_source_type": "Spree::CreditCard",
- "customer_id": "usr_k5nR8xLq",
+ "payment_source_id": null,
+ "payment_source_type": null,
+ "customer_id": "cust_k5nR8xLq",
"payment_method": {
"id": "pm_4xLq8nRt",
"..."
- },
- "created_at": "2025-01-15T10:25:00Z",
- "updated_at": "2025-01-15T10:25:00Z"
+ }
}
```
-## Shipment Events
+## Refund Events
-Events: `shipment.created`, `shipment.updated`, `shipment.shipped`, `shipment.canceled`
+Events: `refund.created`, `refund.updated`, `refund.deleted`
-The Store API/SDK exposes shipments as `fulfillments`, and webhook payloads use the same V3 serializer. Payloads include nested `delivery_method`, `stock_location`, and `delivery_rates`.
+```json
+{
+ "id": "re_7xRt4wPq",
+ "amount": "29.99",
+ "transaction_id": "txn_abc123",
+ "payment_id": "py_3wXz7mRp",
+ "refund_reason_id": "rr_2wMn9xPq",
+ "originator_id": null,
+ "originator_type": null
+}
+```
+
+## Fulfillment Events
+
+Events: `fulfillment.created`, `fulfillment.updated`, `fulfillment.deleted`, `fulfillment.fulfilled`, `fulfillment.delivered`, `fulfillment.canceled`
+
+`fulfillment.fulfilled` fires when a fulfillment is handed over — shipped, collected, or made available for download. Its `metadata` contains `notify_customer`, which tells you whether the customer should be emailed about it. `fulfillment.delivered` carries the same key.
+
+Fulfillment payloads include nested `deliveries`, `delivery_method`, `stock_location`, and `delivery_rates`.
```json
{
"id": "ful_9xPq4wMn",
"number": "H123456789",
- "status": "shipped",
+ "status": "fulfilled",
"fulfillment_type": "shipping",
"tracking": "1Z999AA10123456784",
- "tracking_url": "https://tools.usps.com/go/TrackConfirmAction?tLabels=1Z999AA10123456784",
+ "tracking_url": "https://www.ups.com/track?tracknum=1Z999AA10123456784",
+ "pickup_point_data": null,
+ "selected_delivery_rate_id": "dr_5wPq9mXz",
+ "unpriced": false,
"cost": "10.00",
"display_cost": "$10.00",
+ "total": "10.00",
+ "display_total": "$10.00",
+ "discount_total": "0.00",
+ "display_discount_total": "$0.00",
+ "additional_tax_total": "0.00",
+ "display_additional_tax_total": "$0.00",
+ "included_tax_total": "0.00",
+ "display_included_tax_total": "$0.00",
+ "tax_total": "0.00",
+ "display_tax_total": "$0.00",
"fulfilled_at": "2025-01-16T14:00:00Z",
- "created_at": "2025-01-15T10:30:00Z",
- "updated_at": "2025-01-16T14:00:00Z",
+ "delivered_at": null,
+ "items": [
+ { "item_id": "li_7xRt4wPq", "variant_id": "variant_k5nR8xLq", "quantity": 2 }
+ ],
+ "deliveries": [],
"delivery_method": {
"id": "dm_2wMn7xRt",
"..."
},
"stock_location": {
- "id": "sl_2wMn7xRt",
+ "id": "sloc_2wMn7xRt",
"..."
},
"delivery_rates": []
@@ -300,9 +366,9 @@ The Store API/SDK exposes shipments as `fulfillments`, and webhook payloads use
## Product Events
-Events: `product.created`, `product.updated`, `product.deleted`, `product.activate`, `product.archive`, `product.out_of_stock`, `product.back_in_stock`
+Events: `product.created`, `product.updated`, `product.deleted`, `product.drafted`, `product.proposed`, `product.approved`, `product.rejected`, `product.activated`, `product.archived`, `product.out_of_stock`, `product.back_in_stock`
-Product event payloads include pricing, stock status, and availability flags. Conditional associations (variants, media, option types, categories, custom fields) are not included in event payloads.
+Product event payloads include pricing, stock status, and availability flags. Variants, media, option types, categories, and custom fields are not included.
```json
{
@@ -310,18 +376,24 @@ Product event payloads include pricing, stock status, and availability flags. Co
"name": "Spree Tote Bag",
"slug": "spree-tote-bag",
"description": "A beautiful tote bag",
+ "description_html": "<p>A beautiful tote bag</p>",
+ "meta_title": null,
"meta_description": null,
"meta_keywords": null,
"variant_count": 3,
- "default_variant_id": "var_k5nR8xLq",
+ "default_variant_id": "variant_k5nR8xLq",
+ "buy_box_variant_id": null,
+ "seller_id": null,
"thumbnail_url": "https://cdn.example.com/images/tote-bag.jpg",
"purchasable": true,
"in_stock": true,
"backorderable": false,
"available": true,
+ "preorder": false,
+ "preorder_ships_at": null,
"tags": ["summer", "accessories"],
"price": {
- "id": "pri_4wPq9mXz",
+ "id": "price_4wPq9mXz",
"amount": "29.99",
"amount_in_cents": 2999,
"display_amount": "$29.99",
@@ -332,9 +404,7 @@ Product event payloads include pricing, stock status, and availability flags. Co
"price_list_id": null
},
"original_price": null,
- "available_on": "2025-01-01T00:00:00Z",
- "created_at": "2025-01-01T00:00:00Z",
- "updated_at": "2025-01-15T10:00:00Z"
+ "available_on": "2025-01-01T00:00:00Z"
}
```
@@ -342,42 +412,43 @@ Product event payloads include pricing, stock status, and availability flags. Co
Events: `variant.created`, `variant.updated`, `variant.deleted`
-Variant event payloads include pricing, stock status, and always-included `option_values`. Conditional associations (media, custom fields) are not included in event payloads.
+Variant event payloads include pricing, stock status, and `option_values`. Media and custom fields are not included.
```json
{
- "id": "var_k5nR8xLq",
+ "id": "variant_k5nR8xLq",
"product_id": "prod_86Rf07xd4z",
+ "seller_id": null,
"sku": "SPR-TOTE-BLK",
- "is_master": false,
"options_text": "Size: M, Color: Black",
"track_inventory": true,
"media_count": 2,
- "thumbnail": "https://cdn.example.com/images/tote-bag-black.jpg",
+ "thumbnail_url": "https://cdn.example.com/images/tote-bag-black.jpg",
"purchasable": true,
"in_stock": true,
"backorderable": false,
+ "preorder": false,
+ "preorder_ships_at": null,
"weight": 0.5,
"height": 40.0,
"width": 35.0,
"depth": 10.0,
+ "weight_unit": "kg",
+ "dimensions_unit": "cm",
+ "minimum_order_quantity": 1,
+ "order_multiple": 1,
+ "purchase_unit": "unit",
+ "units_per_carton": null,
"price": {
- "id": "pri_4wPq9mXz",
+ "id": "price_4wPq9mXz",
"amount": "29.99",
- "amount_in_cents": 2999,
- "display_amount": "$29.99",
- "compare_at_amount": null,
- "compare_at_amount_in_cents": null,
- "display_compare_at_amount": null,
"currency": "USD",
- "price_list_id": null
+ "..."
},
"original_price": null,
- "created_at": "2025-01-01T00:00:00Z",
- "updated_at": "2025-01-15T10:00:00Z",
"option_values": [
- { "id": "ov_2wMn9xPq", "name": "M", "presentation": "Medium" },
- { "id": "ov_3xLq8nRt", "name": "Black", "presentation": "Black" }
+ { "id": "optval_2wMn9xPq", "name": "m", "label": "M", "..." },
+ { "id": "optval_3xLq8nRt", "name": "black", "label": "Black", "..." }
]
}
```
@@ -388,7 +459,7 @@ Events: `price.created`, `price.updated`, `price.deleted`
```json
{
- "id": "pri_4wPq9mXz",
+ "id": "price_4wPq9mXz",
"amount": "29.99",
"amount_in_cents": 2999,
"display_amount": "$29.99",
@@ -400,45 +471,38 @@ Events: `price.created`, `price.updated`, `price.deleted`
}
```
-## Image Events
+## Media Events
-Events: `image.created`, `image.updated`, `image.deleted`
+Events: `media.created`, `media.updated`, `media.deleted`
-Image payloads include URLs for all configured image variants (mini, small, medium, large, xlarge).
+Media events carry a short payload. Fetch the product or variant from the API when you need the image URLs.
```json
{
- "id": "img_5mXz3wPq",
- "type": "Spree::Image",
- "viewable_type": "Spree::Variant",
- "viewable_id": "var_k5nR8xLq",
+ "id": "media_5mXz3wPq",
+ "media_type": "image",
+ "viewable_type": "product",
+ "viewable_id": "prod_86Rf07xd4z",
"position": 1,
"alt": "Black tote bag front view",
- "original_url": "https://cdn.example.com/images/original.jpg",
- "mini_url": "https://cdn.example.com/images/mini.jpg",
- "small_url": "https://cdn.example.com/images/small.jpg",
- "medium_url": "https://cdn.example.com/images/medium.jpg",
- "large_url": "https://cdn.example.com/images/large.jpg",
- "xlarge_url": "https://cdn.example.com/images/xlarge.jpg",
- "og_image_url": "https://cdn.example.com/images/og.jpg",
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2025-01-01T00:00:00Z"
}
```
-## Stock Item Events
+## Stock Level Events
+
+Events: `stock_level.created`, `stock_level.updated`, `stock_level.deleted`
-Events: `stock_item.created`, `stock_item.updated`, `stock_item.deleted`
+A stock level is the quantity of one variant at one stock location.
```json
{
- "id": "si_6nRt2xLq",
+ "id": "sl_6nRt2xLq",
"count_on_hand": 25,
"backorderable": false,
- "stock_location_id": "sl_2wMn7xRt",
- "variant_id": "var_k5nR8xLq",
- "created_at": "2025-01-01T00:00:00Z",
- "updated_at": "2025-01-15T10:00:00Z"
+ "stock_location_id": "sloc_2wMn7xRt",
+ "variant_id": "variant_k5nR8xLq"
}
```
@@ -450,10 +514,9 @@ Events: `stock_movement.created`, `stock_movement.updated`, `stock_movement.dele
{
"id": "sm_7xRt4wPq",
"quantity": -1,
- "action": "sold",
- "originator_type": "Spree::Shipment",
- "originator_id": "ful_9xPq4wMn",
- "stock_item_id": "si_6nRt2xLq",
+ "kind": "shipped",
+ "reason": null,
+ "stock_level_id": "sl_6nRt2xLq",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z"
}
@@ -461,16 +524,15 @@ Events: `stock_movement.created`, `stock_movement.updated`, `stock_movement.dele
## Stock Transfer Events
-Events: `stock_transfer.created`, `stock_transfer.updated`, `stock_transfer.deleted`
+Events: `stock_transfer.created`, `stock_transfer.updated`, `stock_transfer.deleted`, `stock_transfer.draft`, `stock_transfer.ready_to_ship`, `stock_transfer.shipped`, `stock_transfer.partially_received`, `stock_transfer.received`, `stock_transfer.over_received`, `stock_transfer.canceled`
```json
{
"id": "st_8mXz3wPq",
"number": "T123456789",
- "type": "Spree::StockTransfer",
"reference": "Warehouse rebalance",
- "source_location_id": "sl_2wMn7xRt",
- "destination_location_id": "sl_9xPq4wMn",
+ "source_location_id": "sloc_2wMn7xRt",
+ "destination_location_id": "sloc_9xPq4wMn",
"created_at": "2025-01-15T10:00:00Z",
"updated_at": "2025-01-15T10:00:00Z"
}
@@ -478,21 +540,27 @@ Events: `stock_transfer.created`, `stock_transfer.updated`, `stock_transfer.dele
## Customer Events
-Events: `customer.created`, `customer.updated`, `customer.deleted`
+Events: `user.created`, `user.updated`, `user.deleted`, `customer.anonymized`, `customer.password_reset_requested`, `customer.password_reset`
-Customer payloads include nested `addresses`, `default_billing_address`, and `default_shipping_address`.
+Customer lifecycle events use the `user` prefix. Customer payloads include nested `addresses`, `default_billing_address`, `default_shipping_address`, `newsletter_subscriber`, and `customer_groups`.
```json
{
- "id": "usr_k5nR8xLq",
+ "id": "cust_k5nR8xLq",
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe",
- "created_at": "2025-01-01T00:00:00Z",
- "updated_at": "2025-01-15T10:00:00Z",
+ "full_name": "John Doe",
+ "phone": null,
+ "accepts_email_marketing": true,
+ "email_marketing_consent_updated_at": "2025-01-01T00:00:00Z",
+ "available_store_credit_total": "0.0",
+ "display_available_store_credit_total": "$0.00",
"addresses": [],
"default_billing_address": null,
- "default_shipping_address": null
+ "default_shipping_address": null,
+ "newsletter_subscriber": null,
+ "customer_groups": []
}
```
@@ -505,54 +573,34 @@ Events: `promotion.created`, `promotion.updated`, `promotion.deleted`
"id": "promo_2wMn9xPq",
"name": "Summer Sale 20% Off",
"description": "20% off all summer items",
- "code": "SUMMER20",
- "type": "Spree::Promotion",
- "kind": "coupon",
- "path": null,
- "match_policy": "all",
- "usage_limit": 1000,
- "advertise": true,
- "multi_codes": false,
- "code_prefix": null,
- "number_of_codes": null,
- "starts_at": "2025-06-01T00:00:00Z",
- "expires_at": "2025-08-31T23:59:59Z",
- "promotion_category_id": "pcat_3xLq8nRt",
- "created_at": "2025-05-15T10:00:00Z",
- "updated_at": "2025-05-15T10:00:00Z"
+ "code": "SUMMER20"
}
```
## Gift Card Events
-Events: `gift_card.created`, `gift_card.updated`, `gift_card.deleted`
+Events: `gift_card.created`, `gift_card.updated`, `gift_card.deleted`, `gift_card.partially_redeemed`, `gift_card.redeemed`, `gift_card.canceled`
```json
{
"id": "gc_4xLq8nRt",
- "code": "****-1234",
- "state": "active",
- "amount": 50.0,
- "amount_used": 15.0,
- "amount_authorized": 0.0,
- "amount_remaining": 35.0,
+ "code": "HOLIDAY-8F3K2M",
+ "status": "partially_redeemed",
+ "amount": "50.0",
+ "amount_used": "15.0",
+ "amount_authorized": "0.0",
+ "amount_remaining": "35.0",
"display_amount": "$50.00",
"display_amount_used": "$15.00",
"display_amount_remaining": "$35.00",
"currency": "USD",
"expired": false,
"active": true,
- "expires_at": "2026-01-01T00:00:00Z",
- "redeemed_at": "2025-02-01T10:00:00Z",
- "created_at": "2025-01-01T00:00:00Z",
- "updated_at": "2025-02-01T10:00:00Z"
+ "expires_at": "2026-01-01",
+ "redeemed_at": null
}
```
-<Info>
-The gift card `code` is displayed as a masked value (e.g., `****-1234`) for security.
-</Info>
-
## Gift Card Batch Events
Events: `gift_card_batch.created`, `gift_card_batch.updated`, `gift_card_batch.deleted`
@@ -561,10 +609,10 @@ Events: `gift_card_batch.created`, `gift_card_batch.updated`, `gift_card_batch.d
{
"id": "gcb_5wPq9mXz",
"codes_count": 100,
- "amount": "25.00",
+ "amount": "25.0",
"currency": "USD",
"prefix": "HOLIDAY",
- "expires_at": "2026-12-31T00:00:00Z",
+ "expires_at": "2026-12-31",
"created_by_id": "adm_8mXz3wPq",
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2025-01-01T00:00:00Z"
@@ -577,10 +625,10 @@ Events: `store_credit.created`, `store_credit.updated`, `store_credit.deleted`
```json
{
- "id": "sc_6nRt2xLq",
- "amount": "100.00",
- "amount_used": "25.00",
- "amount_remaining": "75.00",
+ "id": "credit_6nRt2xLq",
+ "amount": "100.0",
+ "amount_used": "25.0",
+ "amount_remaining": "75.0",
"display_amount": "$100.00",
"display_amount_used": "$25.00",
"display_amount_remaining": "$75.00",
@@ -588,90 +636,68 @@ Events: `store_credit.created`, `store_credit.updated`, `store_credit.deleted`
}
```
-## Refund Events
-
-Events: `refund.created`, `refund.updated`, `refund.deleted`
-
-```json
-{
- "id": "ref_7xRt4wPq",
- "amount": "29.99",
- "transaction_id": "txn_abc123",
- "payment_id": "pay_3wXz7mRp",
- "refund_reason_id": "rr_2wMn9xPq",
- "reimbursement_id": "rei_3xLq8nRt",
- "created_at": "2025-01-20T10:00:00Z",
- "updated_at": "2025-01-20T10:00:00Z"
-}
-```
+## Return Events
-## Reimbursement Events
+Events: `return.created`, `return.updated`, `return.deleted`, `return.requested`, `return.approved`, `return.received`, `return.refunded`, `return.canceled`
-Events: `reimbursement.created`, `reimbursement.updated`, `reimbursement.deleted`
+The returned items are not included. Fetch the return from the API with `expand=return_line_items` when you need them.
```json
{
- "id": "rei_3xLq8nRt",
- "number": "RI123456789",
- "reimbursement_status": "reimbursed",
- "total": "29.99",
+ "id": "ret_8mXz3wPq",
+ "number": "RET123456789",
+ "status": "received",
"order_id": "or_m3Rp9wXz",
- "customer_return_id": "cr_4xLq8nRt",
- "created_at": "2025-01-20T10:00:00Z",
- "updated_at": "2025-01-20T10:00:00Z"
+ "reason_id": "rar_9xPq4wMn",
+ "refund_total": "0.0",
+ "display_refund_total": "$0.00",
+ "approved_at": "2025-01-18T10:00:00Z",
+ "received_at": "2025-01-20T10:00:00Z",
+ "refunded_at": null,
+ "canceled_at": null
}
```
-## Return Authorization Events
+## Exchange Events
-Events: `return_authorization.created`, `return_authorization.updated`, `return_authorization.deleted`
+Events: `exchange.created`, `exchange.updated`, `exchange.deleted`, `exchange.requested`, `exchange.approved`, `exchange.received`, `exchange.fulfilled`, `exchange.canceled`
```json
{
- "id": "ra_8mXz3wPq",
- "number": "RA123456789",
- "state": "authorized",
+ "id": "exch_4xLq8nRt",
+ "number": "EX123456789",
+ "status": "approved",
"order_id": "or_m3Rp9wXz",
- "stock_location_id": "sl_2wMn7xRt",
- "return_authorization_reason_id": "rar_9xPq4wMn",
- "created_at": "2025-01-18T10:00:00Z",
- "updated_at": "2025-01-18T10:00:00Z"
+ "reason_id": "rar_9xPq4wMn",
+ "price_difference": "0.0",
+ "display_price_difference": "$0.00",
+ "approved_at": "2025-01-18T10:00:00Z",
+ "received_at": null,
+ "fulfilled_at": null,
+ "canceled_at": null
}
```
-## Return Item Events
+## Claim Events
-Events: `return_item.created`, `return_item.updated`, `return_item.deleted`
+Events: `claim.created`, `claim.updated`, `claim.deleted`, `claim.opened`, `claim.approved`, `claim.resolved`, `claim.denied`, `claim.canceled`
-```json
-{
- "id": "ri_9xPq4wMn",
- "reception_status": "received",
- "acceptance_status": "accepted",
- "pre_tax_amount": "29.99",
- "included_tax_total": "0.00",
- "additional_tax_total": "2.40",
- "inventory_unit_id": "iu_2wMn7xRt",
- "return_authorization_id": "ra_8mXz3wPq",
- "customer_return_id": "cr_4xLq8nRt",
- "reimbursement_id": "rei_3xLq8nRt",
- "exchange_variant_id": null,
- "created_at": "2025-01-19T10:00:00Z",
- "updated_at": "2025-01-19T10:00:00Z"
-}
-```
-
-## Customer Return Events
-
-Events: `customer_return.created`, `customer_return.updated`, `customer_return.deleted`
+The `resolution` field is `refund`, `replacement`, `refund_and_replacement`, or `null` until the claim is resolved.
```json
{
- "id": "cr_4xLq8nRt",
- "number": "CR123456789",
- "stock_location_id": "sl_2wMn7xRt",
- "created_at": "2025-01-19T10:00:00Z",
- "updated_at": "2025-01-19T10:00:00Z"
+ "id": "claim_2wMn9xPq",
+ "number": "CLM123456789",
+ "status": "resolved",
+ "resolution": "refund",
+ "order_id": "or_m3Rp9wXz",
+ "reason_id": "clr_3xLq8nRt",
+ "refund_total": "29.99",
+ "display_refund_total": "$29.99",
+ "approved_at": "2025-01-18T10:00:00Z",
+ "resolved_at": "2025-01-19T10:00:00Z",
+ "denied_at": null,
+ "canceled_at": null
}
```
@@ -679,7 +705,7 @@ Events: `customer_return.created`, `customer_return.updated`, `customer_return.d
Events: `wishlist.created`, `wishlist.updated`, `wishlist.deleted`
-Wishlist items are a conditional association and are not included in event payloads.
+Wishlist items are not included in wishlist event payloads.
```json
{
@@ -687,77 +713,41 @@ Wishlist items are a conditional association and are not included in event paylo
"name": "My Wishlist",
"token": "abc123def456",
"is_default": true,
- "is_private": true,
- "created_at": "2025-01-01T00:00:00Z",
- "updated_at": "2025-01-15T10:00:00Z"
+ "is_private": true
}
```
-## Wished Item Events
+## Wishlist Item Events
-Events: `wished_item.created`, `wished_item.updated`, `wished_item.deleted`
+Events: `wishlist_item.created`, `wishlist_item.updated`, `wishlist_item.deleted`
-Wished item payloads include a nested `variant`.
+Wishlist item payloads include a nested `variant`.
```json
{
"id": "wi_6nRt2xLq",
- "variant_id": "var_k5nR8xLq",
+ "variant_id": "variant_k5nR8xLq",
+ "product_id": "prod_86Rf07xd4z",
"wishlist_id": "wl_5wPq9mXz",
"quantity": 1,
- "created_at": "2025-01-15T10:00:00Z",
- "updated_at": "2025-01-15T10:00:00Z",
"variant": {
- "id": "var_k5nR8xLq",
+ "id": "variant_k5nR8xLq",
"..."
}
}
```
-## Post Events
-
-Events: `post.created`, `post.updated`, `post.deleted`
-
-```json
-{
- "id": "post_7xRt4wPq",
- "title": "Summer Collection 2025",
- "slug": "summer-collection-2025",
- "meta_title": "Summer Collection | My Store",
- "meta_description": "Discover our new summer collection",
- "published_at": "2025-06-01T00:00:00Z",
- "author_id": "adm_8mXz3wPq",
- "post_category_id": "pcat_9xPq4wMn",
- "created_at": "2025-05-15T10:00:00Z",
- "updated_at": "2025-05-15T10:00:00Z"
-}
-```
-
-## Post Category Events
-
-Events: `post_category.created`, `post_category.updated`, `post_category.deleted`
-
-```json
-{
- "id": "pcat_9xPq4wMn",
- "title": "News",
- "slug": "news",
- "created_at": "2025-01-01T00:00:00Z",
- "updated_at": "2025-01-01T00:00:00Z"
-}
-```
-
## Newsletter Subscriber Events
-Events: `newsletter_subscriber.created`, `newsletter_subscriber.updated`, `newsletter_subscriber.deleted`
+Events: `newsletter_subscriber.created`, `newsletter_subscriber.updated`, `newsletter_subscriber.deleted`, `newsletter_subscriber.subscription_requested`, `newsletter_subscriber.verified`, `newsletter_subscriber.unsubscribe_requested`
```json
{
- "id": "ns_2wMn9xPq",
+ "id": "sub_2wMn9xPq",
"email": "[email protected]",
"verified": true,
"verified_at": "2025-01-02T10:00:00Z",
- "user_id": "usr_k5nR8xLq",
+ "customer_id": "cust_k5nR8xLq",
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2025-01-02T10:00:00Z"
}
@@ -767,14 +757,10 @@ Events: `newsletter_subscriber.created`, `newsletter_subscriber.updated`, `newsl
Events: `digital_asset.created`, `digital_asset.updated`, `digital_asset.deleted`
-The legacy `digital.created` / `digital.updated` / `digital.deleted` names are
-still emitted alongside these, but will stop being sent in a future release —
-subscribe to the `digital_asset.*` names.
-
```json
{
"id": "dig_3xLq8nRt",
- "variant_id": "var_k5nR8xLq",
+ "variant_id": "variant_k5nR8xLq",
"filename": "ebook.pdf",
"content_type": "application/pdf"
}
@@ -797,24 +783,24 @@ file, after the access counter has been incremented.
"expires_at": "2025-01-22T10:30:00Z",
"authorizable": true,
"expired": false,
- "access_limit_exceeded": false,
- "created_at": "2025-01-15T10:30:00Z",
- "updated_at": "2025-01-15T12:00:00Z"
+ "access_limit_exceeded": false
}
```
## Import Events
-Events: `import.created`, `import.updated`, `import.deleted`
+Events: `import.created`, `import.updated`, `import.deleted`, `import.progress`, `import.completed`
```json
{
"id": "imp_5wPq9mXz",
- "number": "I123456789",
- "type": "Spree::Imports::Products",
+ "number": "IM123456789",
+ "type": "products",
"status": "completed",
- "owner_type": "Spree::Store",
- "owner_id": "str_9xPq2wMn",
+ "store_id": "store_9xPq2wMn",
+ "seller_id": null,
+ "owner_type": "store",
+ "owner_id": "store_9xPq2wMn",
"user_id": "adm_8mXz3wPq",
"rows_count": 150,
"created_at": "2025-01-15T10:00:00Z",
@@ -824,16 +810,16 @@ Events: `import.created`, `import.updated`, `import.deleted`
## Import Row Events
-Events: `import_row.created`, `import_row.updated`, `import_row.deleted`
+Events: `import_row.completed`, `import_row.failed`
```json
{
- "id": "ir_6nRt2xLq",
+ "id": "imrow_6nRt2xLq",
"import_id": "imp_5wPq9mXz",
"row_number": 42,
- "status": "success",
+ "status": "completed",
"validation_errors": [],
- "item_type": "Spree::Product",
+ "item_type": "product",
"item_id": "prod_86Rf07xd4z",
"created_at": "2025-01-15T10:01:00Z",
"updated_at": "2025-01-15T10:01:00Z"
@@ -847,8 +833,8 @@ Events: `export.created`, `export.updated`, `export.deleted`
```json
{
"id": "exp_7xRt4wPq",
- "number": "E123456789",
- "type": "Spree::Exports::Products",
+ "number": "EF123456789",
+ "type": "products",
"format": "csv",
"user_id": "adm_8mXz3wPq",
"created_at": "2025-01-15T10:00:00Z",
@@ -856,35 +842,18 @@ Events: `export.created`, `export.updated`, `export.deleted`
}
```
-## Report Events
-
-Events: `report.created`, `report.updated`, `report.deleted`
-
-```json
-{
- "id": "rep_8mXz3wPq",
- "type": "Spree::Reports::SalesByProduct",
- "user_id": "adm_8mXz3wPq",
- "currency": "USD",
- "date_from": "2025-01-01T00:00:00Z",
- "date_to": "2025-01-31T23:59:59Z",
- "created_at": "2025-02-01T10:00:00Z",
- "updated_at": "2025-02-01T10:00:00Z"
-}
-```
-
## Invitation Events
-Events: `invitation.created`, `invitation.updated`, `invitation.deleted`
+Events: `invitation.created`, `invitation.resent`, `invitation.accepted`
```json
{
"id": "inv_9xPq4wMn",
"email": "[email protected]",
"status": "pending",
- "resource_type": "Spree::Store",
- "resource_id": "str_9xPq2wMn",
- "inviter_type": "Spree::AdminUser",
+ "resource_type": "store",
+ "resource_id": "store_9xPq2wMn",
+ "inviter_type": "admin_user",
"inviter_id": "adm_8mXz3wPq",
"invitee_type": null,
"invitee_id": null,
@@ -895,3 +864,27 @@ Events: `invitation.created`, `invitation.updated`, `invitation.deleted`
"updated_at": "2025-01-15T10:00:00Z"
}
```
+
+## Other Events
+
+These resources publish events too. Their payloads use the same serializers as the matching API responses.
+
+| Resource | Events |
+|---|---|
+| Delivery (a tracked parcel within a fulfillment) | `delivery.created`, `delivery.updated`, `delivery.deleted` |
+| Shipping label | `shipping_label.created`, `shipping_label.updated`, `shipping_label.deleted`, `shipping_label.purchased`, `shipping_label.refunded` |
+| Stock reservation | `stock_reservation.created`, `stock_reservation.updated`, `stock_reservation.deleted` |
+| Purchase order | `purchase_order.created`, `purchase_order.updated`, `purchase_order.deleted`, `purchase_order.draft`, `purchase_order.ordered`, `purchase_order.partially_received`, `purchase_order.received`, `purchase_order.over_received`, `purchase_order.canceled` |
+| Stock receipt | `stock_receipt.created`, `stock_receipt.updated`, `stock_receipt.deleted` |
+| Supplier | `supplier.created`, `supplier.updated`, `supplier.deleted` |
+| Catalog | `catalog.created`, `catalog.updated`, `catalog.deleted` |
+| Saved report | `saved_report.created`, `saved_report.updated`, `saved_report.deleted` |
+| Data request (customer data export or erasure) | `data_request.created`, `data_request.updated`, `data_request.deleted`, `data_request.completed` |
+| Company | `company.created`, `company.updated`, `company.deleted` |
+| Company invitation | `company_invitation.created`, `company_invitation.updated`, `company_invitation.deleted`, `company_invitation.accepted`, `company_invitation.revoked` |
+| Tax identifier | `tax_identifier.number_changed` |
+| Tax exemption certificate | `tax_exemption_certificate.verified` |
+| Seller | `seller.created`, `seller.updated`, `seller.deleted`, `seller.invited`, `seller.onboarding_started`, `seller.submitted_for_review`, `seller.approved`, `seller.rejected`, `seller.suspended`, `seller.onboarding_reopened` |
+| Seller requirement submission | `seller_requirement_submission.created`, `seller_requirement_submission.updated`, `seller_requirement_submission.deleted`, `seller_requirement_submission.accepted`, `seller_requirement_submission.rejected`, `seller_requirement_submission.waived` |
+| Seller payout | `seller_payout.completed` |
+| Product submission | `product_submission.created`, `product_submission.updated`, `product_submission.deleted` |
diff --git a/docs/developer/agentic/agent-skills.mdx b/docs/developer/agentic/agent-skills.mdx
index 82b39fa69e..5c181a903d 100644
--- a/docs/developer/agentic/agent-skills.mdx
+++ b/docs/developer/agentic/agent-skills.mdx
@@ -1,7 +1,7 @@
---
title: "Agent Skills"
sidebarTitle: Agent Skills
-description: "Teach your AI coding agent Spree's conventions — 25 installable skills, a Spree expert subagent, slash commands, and safety hooks."
+description: "Teach your AI coding agent Spree's conventions — 38 installable skills, a Spree expert subagent, slash commands, and safety hooks."
---
[spree/agent-skills](https://github.com/spree/agent-skills) is a collection of agent skills for Spree Commerce. Skills are markdown instructions your coding agent loads on demand — they encode Spree's conventions, customization decision trees, API patterns, and upgrade flows, so the agent does things the Spree way instead of improvising from training data.
@@ -10,6 +10,11 @@ The skills work with Claude Code, Codex, Cursor, GitHub Copilot, Cline, Aider, Z
## Install
+<Note>
+The skills target Spree 6. For a Spree 5 project, use the [`v0.3.0` release](https://github.com/spree/agent-skills/tree/v0.3.0) of the skills.
+</Note>
+
+
Run from your project directory:
```bash
@@ -30,7 +35,7 @@ npx skills update # update installed skil
| | |
|---|---|
-| **25 skills** | Project conventions, the customization decision tree (subscriber vs decorator vs dependency injection vs generator), the v3 Store + Admin API, the `spree:model` / `spree:api_resource` generators, TypeScript SDKs, upgrades, and domain deep-dives: catalog, checkout, payments, promotions, pricing, shipping, i18n, testing, security, performance, deployment. |
+| **38 skills** | Project conventions, the customization decision tree (workflow hook vs event subscriber vs provider vs dependency swap vs decorator), workflows and hooks, the v3 Store, Admin and Seller APIs, the `spree:model` / `spree:api_resource` generators, TypeScript SDKs, staff permissions, the admin dashboard and plugins, upgrades (including 5.6 → 6.0), and domain deep-dives: catalog, pricing, inventory, checkout, order totals, taxes, payments, promotions, fulfillment, returns, marketplace, B2B, multi-tenant, reporting, i18n, testing, security, performance, deployment. |
| **`spree-expert` subagent** | A Claude Code agent for multi-step investigations (upgrade audits, checkout-flow debugging, API surface planning). It researches in its own context window and returns a focused report, keeping your main session lean. |
| **2 slash commands** | `/spree:doctor` diagnoses the local dev stack (containers, env, migrations, job queues) and prescribes fixes. `/spree:audit-upgrade [version]` runs a read-only upgrade-readiness audit against your codebase. |
| **2 safety hooks** | Block destructive database commands (`db:drop`, `DROP TABLE spree_*`, mass deletes, force-pushes to main) and warn when an edit introduces a hardcoded secret (Stripe live keys, AWS keys, API tokens). Disable with `SPREE_HOOKS_DISABLE=1`. |
diff --git a/docs/developer/agentic/llm-docs.mdx b/docs/developer/agentic/llm-docs.mdx
index ac92ef171b..e5f7fec805 100644
--- a/docs/developer/agentic/llm-docs.mdx
+++ b/docs/developer/agentic/llm-docs.mdx
@@ -40,7 +40,8 @@ node_modules/@spree/docs/dist/
│ ├── customization/ # decorators, dependencies, events, …
│ ├── storefront/ # Next.js storefront guides
│ ├── sdk/ # TypeScript SDK docs
-│ ├── admin/ # admin customization, form builder, components
+│ ├── dashboard/ # React admin dashboard customization and plugins
+│ ├── providers/ # tax, delivery, payment, search and other providers
│ └── how-to/ # focused guides
└── api-reference/
└── store.yaml # the full Store API OpenAPI spec
diff --git a/docs/developer/cli/admin-api.mdx b/docs/developer/cli/admin-api.mdx
index a727e1bd09..d715d740ea 100644
--- a/docs/developer/cli/admin-api.mdx
+++ b/docs/developer/cli/admin-api.mdx
@@ -52,7 +52,7 @@ For remote stores, create a secret key in the admin under **Settings → API Key
```bash
spree auth login --profile prod --base-url https://store.example.com
-spree api get /orders --profile prod -q "status_eq=complete"
+spree api get /orders --profile prod -q "status_eq=placed"
spree auth status
spree auth logout --profile prod
```
diff --git a/docs/developer/cli/quickstart.mdx b/docs/developer/cli/quickstart.mdx
index 495c02751a..38b7e31030 100644
--- a/docs/developer/cli/quickstart.mdx
+++ b/docs/developer/cli/quickstart.mdx
@@ -11,7 +11,7 @@ The Spree CLI (`@spree/cli`) does two things from your terminal:
```bash
spree dev # boot the project
-spree api get /orders -q status_eq=complete --limit 10 # query the Admin API
+spree api get /orders -q status_eq=placed --limit 10 # query the Admin API
spree api post /products -d '{"name":"Classic Tee","prices":[{"currency":"USD","amount":"29.99"}]}' # create a resource
spree api endpoints --search refund # discover endpoints, offline
```
@@ -229,7 +229,7 @@ Run a generator inside the container. Bare generator names are auto-prefixed wit
```bash
spree generate model Brand name:string slug:string:uniq # runs spree:model
spree generate api_resource Brand name:string slug:string:uniq # runs spree:api_resource — model + v3 Store/Admin API
-spree generate subscriber OmsOrderSync order.completed # runs spree:subscriber — event subscriber + registration
+spree generate subscriber OmsOrderSync order.placed # runs spree:subscriber — event subscriber + registration
spree generate migration AddPositionToSpreeBrands position:integer # Rails built-in, forwarded as-is
```
diff --git a/docs/developer/contributing/creating-an-extension.mdx b/docs/developer/contributing/creating-an-extension.mdx
index 75f73588da..e0075d284d 100644
--- a/docs/developer/contributing/creating-an-extension.mdx
+++ b/docs/developer/contributing/creating-an-extension.mdx
@@ -1,267 +1,415 @@
---
title: Creating a Spree extension
-description: Step-by-step guide to building a Spree extension gem — scaffolding, decorators, migrations, assets, and packaging for distribution on GitHub.
+description: Build a Spree extension gem — models, API endpoints, permissions, workflow hooks and event subscribers — and pair it with a dashboard plugin for the admin UI.
---
## Overview
-Spree Extensions are a way to add new functionality to your Spree store. They are a great way to extend the functionality of Spree and add new features. You can share them with Spree community on Github so anyone can use them, contribute back and share your improvements. For officially supported integrations, see the [Integrations directory](/integrations).
+A Spree extension is a Ruby gem containing a Rails engine. It adds features to any Spree application without forking Spree: new models, new API endpoints, new permissions, and custom logic that runs inside Spree's workflows. You can share an extension with the Spree community on GitHub so anyone can use it and contribute improvements. For officially supported integrations, see the [Integrations directory](/integrations).
+
+An extension is backend code only. Spree 6 has no Rails storefront or Rails admin to add views to:
+
+| Part of the feature | Where it lives |
+|---|---|
+| Models, migrations, business logic | The extension gem |
+| API endpoints (Store API and Admin API) | The extension gem |
+| Permissions for staff roles and API keys | The extension gem |
+| Admin screens | A [dashboard plugin](/developer/dashboard/plugins/overview) — an npm package that talks to your Admin API endpoints |
+| Storefront pages | Your storefront application, through [`@spree/sdk`](/developer/sdk/quickstart) |
<Info>
- This tutorial uses decorators for extending Spree models. For extensions that need to react to events (sync with external services, send notifications, etc.), consider using [Events subscribers](/developer/core-concepts/events) instead - they're easier to test and maintain. See [Customization Quickstart](/developer/customization/quickstart) for guidance on choosing the right approach.
+ Prefer Spree's extension points over [decorators](/developer/customization/decorators): [workflow hooks](/developer/customization/workflows) to change what happens inside a flow, [events](/developer/core-concepts/events) to react after something happened, and `additional_permitted_attributes` to make your own columns writable. They keep working when Spree changes internally. See the [Customization Quickstart](/developer/customization/quickstart) for guidance on choosing the right approach.
</Info>
-## Getting Started
-
-Let's build a simple extension. Suppose we want the ability to mark certain products as being on sale. We'd like to be able to set a sale price on a product and show products that are on sale on a separate products page. This is a great example of how an extension can be used to build on the solid Spree foundation.
+In this guide we build `spree_reviews`: customers read product reviews through the Store API, and staff manage them through the Admin API.
-Install the Spree Extension CLI by running:
+## Generate the extension
+Install the Spree extension generator:
```bash
gem install spree_extension
```
-Run the following command from a directory of your choice outside of our Spree application:
+Run the following command from a directory outside your Spree application:
```bash
-spree-extension simple_sales
+spree-extension create reviews
```
-This creates a `spree_simple_sales` directory with several additional files and directories. After generating the extension make sure you change to its directory:
+This creates a `spree_reviews` directory containing the engine, a gemspec, a test setup and continuous integration configuration. Change to its directory:
```bash
-cd spree_simple_sales
+cd spree_reviews
```
-## Adding a Sale Price to Variants
+<Warning>
+ The generated scaffold still declares a dependency on `spree_admin`, the Spree 5 Rails admin, which does not exist in Spree 6. Remove the `spree_admin` lines from both the `.gemspec` and the `Gemfile` before running `bundle install`. The JavaScript, importmap and asset setup in the scaffold is only used by the Spree 5 admin, so you can delete it too.
+</Warning>
-The first thing we need to do is create a migration that adds a sale_price column to [variants](/developer/core-concepts/products#variants).
+## Add a model
-We can do this with the following command:
-
-```bash
-bin/rails g migration add_sale_price_to_spree_variants sale_price:decimal
-```
+Create the migration in `db/migrate/`:
-Because we are dealing with prices, we need to now edit the generated migration to ensure the correct precision and scale. Edit the file `db/migrate/XXXXXXXXXXX_add_sale_price_to_spree_variants.rb` so that it contains the following:
-
-```ruby
-class AddSalePriceToSpreeVariants < ActiveRecord::Migration[7.1]
+```ruby db/migrate/20260901000000_create_spree_reviews.rb
+class CreateSpreeReviews < ActiveRecord::Migration[8.1]
def change
- add_column :spree_variants, :sale_price, :decimal, precision: 8, scale: 2
+ create_table :spree_reviews do |t|
+ t.references :store, null: false, index: true, foreign_key: false
+ t.references :product, null: false, index: true, foreign_key: false
+ t.integer :rating, null: false
+ t.text :body
+ t.boolean :approved, null: false, default: false
+
+ t.timestamps
+ end
end
end
```
-## Adding Our Extension to the Spree Application
+Then the model:
+
+```ruby app/models/spree/review.rb
+module Spree
+ class Review < Spree.base_class
+ include Spree::SingleStoreResource
+
+ has_prefix_id :review
+ publishes_lifecycle_events
+
+ belongs_to :product, class_name: 'Spree::Product'
-Before we continue development of our extension, let's add it to the Spree application.
+ validates :rating, presence: true, inclusion: { in: 1..5 }
-Within the `my_store` application directory, add the following line to the bottom of our `Gemfile`:
+ scope :approved, -> { where(approved: true) }
-```ruby
-gem 'spree_simple_sales', path: '../spree_simple_sales'
+ self.whitelisted_ransackable_attributes = %w[rating approved]
+ end
+end
```
-You may have to adjust the path somewhat depending on where you created the extension. You want this to be the path relative to the location of the `my_store` application.
+A few Spree conventions are at work here:
-Once you have added the gem, it's time to bundle:
+- **Reviews belong to a store.** `Spree::SingleStoreResource` fills in the store for new records, and the API only returns the current store's reviews. Commerce data is always per store.
+- **Prefixed IDs.** `has_prefix_id` gives every review an ID like `review_k5nR8xLq` in API responses. Integer database IDs are never exposed.
+- **No foreign key constraints** on business tables, and `class_name` on every association.
+- **Lifecycle events.** `publishes_lifecycle_events` makes the model emit `review.created`, `review.updated` and `review.deleted`, which subscribers and [webhooks](/developer/core-concepts/webhooks) can react to.
-```bash
-bundle install
+## Expose it through the API
+
+Add serializers for both APIs. The Admin API serializer extends the Store API one with the fields only staff should see:
+
+```ruby app/serializers/spree/api/v3/review_serializer.rb
+module Spree
+ module Api
+ module V3
+ class ReviewSerializer < BaseSerializer
+ typelize rating: :number, body: [:string, nullable: true]
+
+ attributes :rating, :body
+ end
+ end
+ end
+end
```
-Finally, let's run the `spree_simple_sales` install generator to copy over the migration we just created. Answer **yes** if prompted to run migrations:
+```ruby app/serializers/spree/api/v3/admin/review_serializer.rb
+module Spree
+ module Api
+ module V3
+ module Admin
+ class ReviewSerializer < V3::ReviewSerializer
+ typelize approved: :boolean
+
+ attributes :approved, :created_at, :updated_at
+ end
+ end
+ end
+ end
+end
+```
-```bash
-# context: Your Spree store's app root (i.e. Rails.root); not the extension's root path.
-bin/rails g spree_simple_sales:install
+The Store API controller is read-only and returns approved reviews only:
+
+```ruby app/controllers/spree/api/v3/store/reviews_controller.rb
+module Spree
+ module Api
+ module V3
+ module Store
+ class ReviewsController < ResourceController
+ protected
+
+ def model_class
+ Spree::Review
+ end
+
+ def serializer_class
+ Spree::Api::V3::ReviewSerializer
+ end
+
+ def scope
+ super.approved
+ end
+ end
+ end
+ end
+ end
+end
```
-## Adding a Controller Action to HomeController
+The Admin API controller gives staff full create, read, update and delete access:
-Now we need to extend `Spree::HomeController` and add an action that selects "on sale" products.
+```ruby app/controllers/spree/api/v3/admin/reviews_controller.rb
+module Spree
+ module Api
+ module V3
+ module Admin
+ class ReviewsController < ResourceController
+ scoped_resource :reviews
- Note for the sake of this example that \`Spree::HomeController\` is only included in spree_storefront so you need to make it a dependency on your extensions \*.gemspec file.
+ protected
-Make sure you are in the `spree_simple_sales` root directory and run the following command to create the directory structure for our controller decorator:
+ def model_class
+ Spree::Review
+ end
-```bash
-mkdir -p app/controllers/spree_simple_sales
+ def serializer_class
+ Spree::Api::V3::Admin::ReviewSerializer
+ end
+
+ def resource_permitted_attributes
+ [:product_id, :rating, :body, :approved]
+ end
+ end
+ end
+ end
+ end
+end
```
-Next, create a new file in the directory we just created called `home_controller_decorator.rb` and add the following content to it:
+`scoped_resource :reviews` means only staff roles and secret API keys holding the `read_reviews` or `write_reviews` permission can call these endpoints. The next section registers that permission.
+
+Finally, add the routes. The scaffold's `config/routes.rb` already contains the route hook:
+
+```ruby config/routes.rb
+Spree::Core::Engine.add_routes do
+ namespace :api, defaults: { format: 'json' } do
+ namespace :v3 do
+ namespace :store do
+ resources :reviews, only: [:index, :show]
+ end
-```ruby
-module SpreeSimpleSales
- module HomeControllerDecorator
- def sale
- @products = Spree::Product.joins(:variants_including_master).where.not(sale_price: nil).distinct
+ namespace :admin do
+ resources :reviews
+ end
end
end
end
-
-Spree::HomeController.prepend SpreeSimpleSales::HomeControllerDecorator
```
-This will select just the products that have a variant with a `sale_price` set.
+Pagination, [Ransack](https://github.com/activerecord-hackery/ransack) filtering (`?q[rating_gteq]=4`), sorting and prefixed ID lookup all come from the base `ResourceController`. See [Customizing the API](/developer/customization/api) for everything you can override.
-We also need to add a route to this action in our `config/routes.rb` file. Let's do this now. Update the routes file to contain the following:
+## Register permissions
-```ruby
-Spree::Core::Engine.routes.draw do
- get "/sale" => "home#sale"
-end
+Register your model as a permission scope, so the `read_reviews` and `write_reviews` permissions appear in the staff role editor and can be granted to secret API keys:
+
+```ruby config/initializers/spree.rb
+Spree.permissions.register_scope(:reviews, group: :catalog, resources: -> {
+ [Spree::Review]
+})
```
-## Viewing On Sale Products
+Label the permission for the dashboard in your locale file:
-### Setting the Sale Price for a Variant
+```yaml config/locales/en.yml
+en:
+ spree:
+ permissions_catalog:
+ resources:
+ reviews:
+ label: Reviews
+ description: Product reviews left by customers
+```
-Now that our variants have the attribute `sale_price` available to them, let's update the sample data so we have at least one product that is on sale in our application. We will need to do this in the rails console for the time being, as we have no admin interface to set sale prices for variants. So, in order to do this, first open up the rails console:
+See [Permissions](/developer/customization/permissions) for audiences and read-only scopes.
-```bash
-bin/rails c
+## Extend core models and behavior
+
+Extensions often need to change Spree's own resources as well as add new ones. Reach for these options in order.
+
+### Make a new column writable
+
+Suppose each product gets a `reviews_enabled` switch. Add the column with a migration, then let the existing product endpoints accept it — no controller changes needed:
+
+```ruby lib/spree_reviews/engine.rb
+config.to_prepare do
+ Spree::Product.additional_permitted_attributes += [:reviews_enabled]
+end
```
-Now, follow the steps I take in selecting a product and updating its master variant to have a sale price. Note, you may not be editing the exact same product as I am, but this is not important. We just need one "on sale" product to display on the sales page.
+Always append with `+=`, so you don't remove attributes that other extensions added.
+
+### Run code inside a Spree workflow
-```ruby
-> product = Spree::Product.first
-=> #<Spree::Product id: 107377505, name: "Spree Bag", description: "Lorem ipsum dolor sit amet, consectetuer adipiscing...", available_on: "2013-02-13 18:30:16", deleted_at: nil, permalink: "spree-bag", meta_description: nil, meta_keywords: nil, tax_category_id: 25484906, shipping_category_id: nil, count_on_hand: 10, created_at: "2013-02-13 18:30:16", updated_at: "2013-02-13 18:30:16", on_demand: false>
+[Workflow hooks](/developer/customization/workflows) run your code at a named point inside a core flow — checkout completion, cancellations, refunds, product changes — and can stop the operation. For example, to require a description before a product with reviews enabled goes on sale:
-> variant = product.master
-=> #<Spree::Variant id: 833839126, sku: "SPR-00012", weight: nil, height: nil, width: nil, depth: nil, deleted_at: nil, is_master: true, product_id: 107377505, count_on_hand: 10, cost_price: #<BigDecimal:7f8dda5eebf0,'0.21E2',9(36)>, position: nil, lock_version: 0, on_demand: false, cost_currency: nil, sale_price: nil>
+```ruby config/initializers/spree.rb
+Spree.hooks.register('products.activate.validate', 'SpreeReviews::RequireDescription')
+```
-> variant.sale_price = 8.00
-=> 8.0
+```ruby app/services/spree_reviews/require_description.rb
+module SpreeReviews
+ class RequireDescription
+ def call(workflow)
+ product = workflow.product
+ return unless product.reviews_enabled
+ return if product.description.present?
-> variant.save
-=> true
+ workflow.reject!('Add a description before activating a product with reviews.')
+ end
+ end
+end
```
-## Decorating Variants
+Hook names are checked when the application boots, so a typo fails at startup rather than silently never running.
+
+### React to events
-Let's fix our extension so that it uses the `sale_price` when it is present.
+To do something *after* an event, without influencing it, write an [event subscriber](/developer/core-concepts/events). For example, to ask customers for a review once their order arrives:
-Next, create the file `app/models/spree_simple_sales/variant_decorator.rb` and add the following content to it:
+```ruby app/subscribers/spree_reviews/review_request_subscriber.rb
+module SpreeReviews
+ class ReviewRequestSubscriber < Spree::Subscriber
+ subscribes_to 'order.delivered'
-```ruby
-module SpreeSimpleSales
- module VariantDecorator
- def price_in(currency)
- return super unless sale_price.present?
- Spree::Price.new(variant_id: self.id, amount: self.sale_price, currency: currency)
+ def handle(event)
+ order = Spree::Order.find_by_prefix_id(event.payload['id'])
+ return unless order
+
+ SpreeReviews::ReviewRequestMailer.request_review(order).deliver_later
end
end
end
+```
-Spree::Variant.prepend SpreeSimpleSales::VariantDecorator
+Subscribers are not discovered automatically. Register them from the engine:
+
+```ruby lib/spree_reviews/engine.rb
+config.after_initialize do
+ Spree.subscribers << SpreeReviews::ReviewRequestSubscriber
+end
```
-If there is a `sale_price` present on the product's master variant, we return that price. Otherwise, we call the original implementation of `price_in` using `return super`.
+### Decorators, as a last resort
-## Testing Our Decorator
+When none of the above fits — adding an association to a core model, for example — use a [decorator](/developer/customization/decorators):
-It's always a good idea to test your code. We should be extra careful to write tests for our Variant decorator since we are modifying core Spree functionality. Let's write a couple of simple unit tests for `variant_decorator.rb`
+```ruby app/models/spree_reviews/product_decorator.rb
+module SpreeReviews
+ module ProductDecorator
+ def self.prepended(base)
+ base.has_many :reviews, class_name: 'Spree::Review', dependent: :destroy
+ end
+ end
+end
-### Generating the Test App
+Spree::Product.prepend SpreeReviews::ProductDecorator
+```
+
+Decorators are not loaded automatically. Load them from your engine:
+
+```ruby lib/spree_reviews/engine.rb
+config.to_prepare do
+ Dir.glob(root.join('app/**/*_decorator*.rb')) do |decorator|
+ Rails.configuration.cache_classes ? require(decorator) : load(decorator)
+ end
+end
+```
-An extension is not a full Rails application, so we need something to test our extension against. By running the Spree `test_app` rake task, we can generate a barebones Spree application within our `spec` directory to run our tests against.
+## Add admin screens
-We can do this with the following command from the root directory of our extension:
+Admin screens are built as a [dashboard plugin](/developer/dashboard/plugins/overview): a React package that registers navigation entries, pages and product page widgets, and reads and writes data through your Admin API endpoints. Scaffold one with the Spree CLI:
```bash
-bundle exec rake test_app
+npx @spree/cli plugin new reviews
```
-After this command completes, you should be able to run `rspec` and see the following output:
+See [Scaffolding](/developer/dashboard/plugins/scaffolding) and [Backend integration](/developer/dashboard/customization/backend) to connect it to the endpoints above, and [Distributing](/developer/dashboard/plugins/distributing) to ship the gem and the npm package together.
-```bash
-No examples found.
+## Add the extension to your application
+
+From your Spree application's backend directory, add the gem to the `Gemfile`. Adjust the path to point at your extension:
-Finished in 0.00005 seconds
-0 examples, 0 failures
+```ruby Gemfile
+gem 'spree_reviews', path: '../spree_reviews'
```
-Great! We're ready to start adding some tests. Let's replicate the extension's directory structure in our spec directory by running the following command
+Install it, then copy the extension's migrations into the application and run them:
```bash
-mkdir -p spec/models/spree
+bundle install
+bin/rails g spree_reviews:install
```
-Now, let's create a new file in this directory called `variant_decorator_spec.rb` and add the following tests to it:
-
-```ruby
-require 'spec_helper'
+The Store API now serves reviews at `/api/v3/store/reviews`, and the Admin API manages them at `/api/v3/admin/reviews`.
-describe Spree::Variant do
- describe "#price_in" do
- it "returns the sale price if it is present" do
- variant = create(:variant, sale_price: 8.00)
- expected = Spree::Price.new(variant_id: variant.id, currency: "USD", amount: variant.sale_price)
+## Test the extension
- result = variant.price_in("USD")
+An extension is not a full Rails application, so its tests run against a small generated Spree application. Create it from the extension's root directory:
- expect(result.variant_id).to eq(expected.variant_id)
- expect(result.amount.to_f).to eq(expected.amount.to_f)
- expect(result.currency).to eq(expected.currency)
- end
-
- it "returns the normal price if it is not on sale" do
- variant = create(:variant, price: 15.00)
- expected = Spree::Price.new(variant_id: variant.id, currency: "USD", amount: variant.price)
+```bash
+bundle exec rake test_app
+```
- result = variant.price_in("USD")
+Run this again whenever you add a migration. Tests use RSpec and Factory Bot, with Spree's factories and test helpers coming from [`spree_dev_tools`](https://github.com/spree/spree_dev_tools). Add a factory for your model:
- expect(result.variant_id).to eq(expected.variant_id)
- expect(result.amount.to_f).to eq(expected.amount.to_f)
- expect(result.currency).to eq(expected.currency)
- end
+```ruby lib/spree_reviews/factories.rb
+FactoryBot.define do
+ factory :review, class: Spree::Review do
+ product
+ rating { 5 }
+ approved { true }
end
end
```
-These specs test that the `price_in` method we overrode in our `VariantDecorator` returns the correct price both when the sale price is present and when it is not.
-
-## Summary
-
-In this tutorial, you learned how to both install extensions and create your own. A lot of core Spree development concepts were covered and you gained exposure to some of the Spree internals.
+Then test your endpoints:
-## Alternative Approaches
+```ruby spec/controllers/spree/api/v3/admin/reviews_controller_spec.rb
+require 'spec_helper'
-While this tutorial uses decorators to extend Spree's core behavior, modern Spree provides additional patterns that may be more appropriate depending on your use case:
+RSpec.describe Spree::Api::V3::Admin::ReviewsController, type: :controller do
+ render_views
+ routes { Spree::Core::Engine.routes }
-| Use Case | Recommended Approach |
-|----------|---------------------|
-| Structural changes (associations, validations) | Decorators (as shown in this tutorial) |
-| React to model changes | [Events subscribers](/developer/core-concepts/events) |
-| External service integration | [Webhooks](/developer/core-concepts/webhooks) |
-| Replace core services | [Dependencies injection](/developer/customization/dependencies) |
-| Add admin UI elements | [Admin Partials](/developer/dashboard/customization/quickstart) |
-| Add admin menu items | [Admin Navigation](/developer/dashboard/customization/navigation) |
+ include_context 'API v3 Admin authenticated'
-For example, if your extension needs to sync data with an external service when products are updated, use an Events subscriber instead of a decorator callback:
+ let!(:review) { create(:review, store: store) }
-```ruby app/subscribers/my_extension/product_sync_subscriber.rb
-module MyExtension
- class ProductSyncSubscriber < Spree::Subscriber
- subscribes_to 'product.updated'
+ before { request.headers.merge!(headers) }
- def handle(event)
- product = Spree::Product.find_by_prefix_id(event.payload['id'])
- return unless product
+ it 'lists reviews' do
+ get :index, as: :json
- ExternalService.sync(product)
- end
+ expect(response).to have_http_status(:ok)
+ expect(json_response['data'].map { |r| r['id'] }).to include(review.prefixed_id)
end
end
```
-## Related Documentation
+Run the suite:
+
+```bash
+bundle exec rspec
+```
+
+Test the logic you wrote — the approved-only scope, your hook handler, your subscriber — rather than behavior that Rails and Spree already guarantee.
+
+## Related documentation
+- [Customization Quickstart](/developer/customization/quickstart) - Choose the right extension point
+- [Customizing the API](/developer/customization/api) - Controllers, serializers and permitted attributes
+- [Services & Workflows](/developer/customization/workflows) - The full list of workflow hooks
- [Events](/developer/core-concepts/events) - Subscribe to Spree events
-- [Webhooks](/developer/core-concepts/webhooks) - HTTP callbacks for external integrations
-- [Dependencies](/developer/customization/dependencies) - Replace core services
-- [Customization Quickstart](/developer/customization/quickstart) - Choose the right approach
+- [Permissions](/developer/customization/permissions) - Register permission scopes
+- [Dashboard plugins](/developer/dashboard/plugins/overview) - Admin UI for your extension
diff --git a/docs/developer/contributing/developing-spree.mdx b/docs/developer/contributing/developing-spree.mdx
index 33e5bc2ac6..d575046935 100644
--- a/docs/developer/contributing/developing-spree.mdx
+++ b/docs/developer/contributing/developing-spree.mdx
@@ -23,7 +23,7 @@ You need **Node.js 20+** to run the workspace scripts (including `pnpm server:se
Spree is a monorepo with three main areas:
-- **`spree/`** — Ruby gems (core, api, admin, emails) distributed as separate packages via RubyGems
+- **`spree/`** — Ruby gems (core, api, dashboard, emails, opentelemetry, and provider gems under `spree/providers/`) distributed as separate packages via RubyGems
- **`packages/`** — TypeScript packages (SDKs, CLI, project scaffolding, docs, React dashboard)
- **`server/`** — A Rails application cloned from [spree-starter](https://github.com/spree/spree-starter) that mounts the local Spree gems (not checked in — `pnpm server:setup` creates it)
@@ -38,9 +38,9 @@ pnpm server:setup # ~5–10 min on first run; idempotent
`pnpm server:setup` clones [spree-starter](https://github.com/spree/spree-starter) into `./server/`, wires it to load Spree gems from the monorepo via a Docker compose overlay, builds the dev image, starts the stack (Postgres + Meilisearch + a single Rails `web` container — background jobs run in-process via Solid Queue), and prepares the database. The full sequence lives in `scripts/server-setup.sh`.
-When it's done, the backend is up at [http://localhost:3000](http://localhost:3000) and the admin is at [http://localhost:3000/admin](http://localhost:3000/admin). Sign in with the seed admin: **`[email protected]`** / **`spree123`** (override at seed time with `ADMIN_EMAIL` / `ADMIN_PASSWORD` env vars — see `spree/core/app/services/spree/seeds/admin_user.rb`).
+When it's done, the backend is up at [http://localhost:3000](http://localhost:3000). The React dashboard runs as its own development server — start it with `pnpm dashboard:dev` and open [http://localhost:5173](http://localhost:5173). The setup script prints a one-time link for creating the first admin account; open it once the dashboard is running. To seed an admin account instead, set the `ADMIN_EMAIL` and `ADMIN_PASSWORD` environment variables before seeding (see `spree/core/app/services/spree/seeds/admin_user.rb`).
-Optionally load sample products, taxonomies, and option types:
+Optionally load sample products, categories, and option types:
```bash
pnpm server:load_sample_data
@@ -110,8 +110,12 @@ The Spree [Rails engines](https://guides.rubyonrails.org/engines.html) live insi
|---|---|---|
| `core` | `spree_core` | Models, services, business logic |
| `api` | `spree_api` | REST APIs |
-| `admin` | `spree_admin` | Admin dashboard |
-| `emails` | `spree_emails` | Transactional emails |
+| `dashboard` | `spree_dashboard` | Serves a built React dashboard and seller panel from your Rails server |
+| `emails` | `spree_emails` | Transactional emails (optional) |
+| `opentelemetry` | `spree_opentelemetry` | OpenTelemetry tracing (optional) |
+| `providers/stripe` | `spree_stripe` | Stripe payments (optional) |
+| `providers/easypost` | `spree_easypost` | EasyPost delivery rates and shipping labels (optional) |
+| `providers/meilisearch` | `spree_meilisearch` | Meilisearch product search (optional) |
### Spree namespace
@@ -133,7 +137,7 @@ bundle exec rake test_app
bundle exec rspec
```
-Replace `core` with `api`, `admin`, or `emails` to test other engines.
+Replace `core` with `api`, `dashboard`, `emails`, `opentelemetry`, or a provider path such as `providers/stripe` to test other engines.
By default engine tests run against SQLite3. To run against PostgreSQL, set the `DB` environment variable:
@@ -181,15 +185,7 @@ bundle exec parallel_rspec -n 4 spec
After schema changes, re-run `bundle exec rake parallel_setup` to update the worker databases.
-### Integration tests (legacy Rails admin)
-
-The legacy Rails admin (`spree/admin`) ships feature specs that run in a real browser via chromedriver. You only need this if you're touching the legacy admin UI.
-
-Install chromedriver on macOS:
-
-```bash
-brew install chromedriver
-```
+### Integration tests
The React dashboard (`packages/dashboard`) has its own end-to-end test suite running on Playwright against a real Rails backend — see [Dashboard E2E tests](#dashboard-e2e-tests) under TypeScript Development.
@@ -216,7 +212,7 @@ The backend setup is the same as for Ruby work — see [Setup](#setup) above. Wi
| `@spree/cli` | `packages/cli` | yes | CLI for managing Spree Commerce projects |
| `create-spree-app` | `packages/create-spree-app` | yes | Project scaffolding (`npm create spree-app`) |
| `@spree/docs` | `packages/docs` | yes | Developer documentation for AI agents and local reference |
-| `@spree/dashboard` | `packages/dashboard` | no | React SPA admin dashboard (replaces the legacy Rails admin) |
+| `@spree/dashboard` | `packages/dashboard` | no | React SPA admin dashboard |
| `@spree/dashboard-core` | `packages/dashboard-core` | no | Framework: registries, providers, generic infra hooks for the dashboard |
| `@spree/dashboard-ui` | `packages/dashboard-ui` | no | Design system used by the dashboard |
| `@spree/sdk-core` | `packages/sdk-core` | no | Shared HTTP/retry/error layer used by both SDKs |
@@ -259,7 +255,7 @@ cd packages/dashboard
pnpm dev # http://localhost:5173
```
-Sign in with `[email protected]` / `spree123`. To point at a non-default backend, set `VITE_SPREE_API_URL` (also needs to be set at build time for production bundles, not just dev):
+Sign in with the admin account you created from the setup link (see [Setup](#setup)). To point at a non-default backend, set `VITE_SPREE_API_URL` (also needs to be set at build time for production bundles, not just dev):
```bash
VITE_SPREE_API_URL=https://my-spree.example.com pnpm dev
diff --git a/docs/developer/core-concepts/catalogs.mdx b/docs/developer/core-concepts/catalogs.mdx
index b8408e69ca..0468bc551f 100644
--- a/docs/developer/core-concepts/catalogs.mdx
+++ b/docs/developer/core-concepts/catalogs.mdx
@@ -147,7 +147,7 @@ A [Channel](/developer/core-concepts/channels) is not assigned — it names its
```typescript Admin SDK
await adminClient.catalogs.assign(catalog.id, {
assignable_type: 'customer_group',
- assignable_id: 'cgrp_xxx',
+ assignable_id: 'cg_xxx',
})
```
@@ -155,7 +155,7 @@ await adminClient.catalogs.assign(catalog.id, {
curl -X POST 'https://api.mystore.com/api/v3/admin/catalogs/cat_xxx/assign' \
-H 'X-Spree-API-Key: sk_xxx' \
-H 'Content-Type: application/json' \
- -d '{ "assignable_type": "customer_group", "assignable_id": "cgrp_xxx" }'
+ -d '{ "assignable_type": "customer_group", "assignable_id": "cg_xxx" }'
```
</CodeGroup>
diff --git a/docs/developer/core-concepts/channels.mdx b/docs/developer/core-concepts/channels.mdx
index fe05ce8606..23df08c71b 100644
--- a/docs/developer/core-concepts/channels.mdx
+++ b/docs/developer/core-concepts/channels.mdx
@@ -38,7 +38,7 @@ erDiagram
| `default` | Exactly one channel per store is the default. Used as a fallback when no channel header is present and as the auto-publish target for new products | `true` |
| `storefront_access` | Controls what an anonymous visitor may see: `public`, `prices_hidden`, or `login_required`. Unset inherits the store's setting. See [Storefront Access Gating](#storefront-access-gating) | `login_required` |
| `guest_checkout` | Whether an order may be placed without an account on this channel. Unset inherits the store's setting | `false` |
-| `preferred_order_routing_strategy` | Optional per-channel override of the store's [Order Routing](/developer/core-concepts/fulfillments#order-routing) strategy | `Spree::OrderRouting::Strategy::Rules` |
+| `preferred_order_routing_strategy` | Optional per-channel override of the store's [Order Routing](/developer/how-to/custom-order-routing) strategy | `Spree::OrderRouting::Strategy::Rules` |
`code` is normalized to a URL-safe slug on save — `POS` becomes `pos`, `Point of Sale!` becomes `point-of-sale`. Leaving `code` blank derives it from `name`.
@@ -107,7 +107,7 @@ Product status (`draft` / `active` / `archived`) is the **outer gate**: a Draft
Every order is attributed to one channel. The channel is set from the `X-Spree-Channel` header on cart creation, from the merchant's selection on the "New order" form, or defaults to the store's primary channel.
-This attribution drives reporting (best-selling by channel, revenue per channel) and per-channel order routing — see [Order Routing](/developer/core-concepts/fulfillments#order-routing).
+This attribution drives reporting (best-selling by channel, revenue per channel) and per-channel order routing — see [Order Routing](/developer/how-to/custom-order-routing).
### Storefront Access Gating
@@ -240,7 +240,7 @@ The write contract is **full-set**: the array represents the complete desired st
- [Stores](/developer/core-concepts/stores) — Channels belong to a store
- [Markets](/developer/core-concepts/markets) — Different from channels: markets segment geography/currency, channels segment selling surfaces
- [Products](/developer/core-concepts/products) — Product catalog and publication
-- [Order Routing](/developer/core-concepts/fulfillments#order-routing) — Channels can override the store's routing strategy
+- [Order Routing](/developer/how-to/custom-order-routing) — Channels can override the store's routing strategy
- [Store SDK: Products](/developer/sdk/store/products) — Channel-scoped product listing and filtering
- [Admin SDK: Resources](/developer/sdk/admin/resources) — How `adminClient.channels.addProducts` and other resource methods are structured
- [Wholesale Portal](/developer/storefront/nextjs/wholesale) — A gated channel driving the Next.js storefront's B2B surface
diff --git a/docs/developer/core-concepts/companies.mdx b/docs/developer/core-concepts/companies.mdx
index 2fe10b7e55..b162e5935a 100644
--- a/docs/developer/core-concepts/companies.mdx
+++ b/docs/developer/core-concepts/companies.mdx
@@ -227,7 +227,8 @@ await adminClient.companies.taxIdentifiers.create('comp_xxx', {
value: 'NL123456789B01',
})
-// Validation runs against the official registry, in the background
+// Out of the box this checks the number's format and checksum only.
+// Registry lookups (such as VIES) come from an extension that re-registers the validator.
await adminClient.companies.taxIdentifiers.validate('comp_xxx', 'txid_xxx')
```
diff --git a/docs/developer/core-concepts/delivery-setup.mdx b/docs/developer/core-concepts/delivery-setup.mdx
index e9c1c44b4e..4a35e35bf1 100644
--- a/docs/developer/core-concepts/delivery-setup.mdx
+++ b/docs/developer/core-concepts/delivery-setup.mdx
@@ -73,7 +73,7 @@ const profiles = await adminClient.deliveryProfiles.list()
// Ship a product as a download
await adminClient.products.update('prod_xxx', {
- delivery_profile_id: 'dp_digital',
+ delivery_profile_id: 'fp_digital',
})
```
@@ -86,7 +86,7 @@ curl 'https://api.mystore.com/api/v3/admin/delivery_profiles' \
curl -X PATCH 'https://api.mystore.com/api/v3/admin/products/prod_xxx' \
-H 'X-Spree-API-Key: sk_xxx' \
-H 'Content-Type: application/json' \
- -d '{ "delivery_profile_id": "dp_digital" }'
+ -d '{ "delivery_profile_id": "fp_digital" }'
```
</CodeGroup>
diff --git a/docs/developer/core-concepts/discounts.mdx b/docs/developer/core-concepts/discounts.mdx
index 3429c9f2b5..c4ebf2614c 100644
--- a/docs/developer/core-concepts/discounts.mdx
+++ b/docs/developer/core-concepts/discounts.mdx
@@ -62,7 +62,7 @@ Note the difference between `value` and `amount`. `value` is the rule — "10 pe
## Reading discounts on an order
-Whatever produced them, the rows read the same way:
+The Store API summarizes the promotions applied to a cart or order under `discounts` — one entry per promotion, with its name, code and total amount. The individual discount rows, including manual ones, are read through the Admin API (`GET /api/v3/admin/orders/{id}/discounts`).
<CodeGroup>
@@ -72,10 +72,10 @@ const cart = await client.carts.get(cartId)
cart.display_discount_total // "-$12.00"
cart.discounts.forEach((discount) => {
- discount.label // "Summer Sale"
- discount.kind // "promotion" or "manual"
+ discount.name // "Summer Sale"
discount.code // "SUMMER20", when a code was used
discount.display_amount // "-$12.00"
+ discount.promotion_id // "promo_xxx"
})
```
diff --git a/docs/developer/core-concepts/events.mdx b/docs/developer/core-concepts/events.mdx
index 787778aeb2..6662406289 100644
--- a/docs/developer/core-concepts/events.mdx
+++ b/docs/developer/core-concepts/events.mdx
@@ -44,12 +44,14 @@ On top of that, meaningful business moments get their own events:
| `order.placed` | A customer completed checkout |
| `order.paid` | Payment is settled in full |
| `order.canceled` | The order was cancelled |
-| `order.shipped` / `order.delivered` | Everything has shipped / arrived |
+| `order.fulfilled` / `order.delivered` | Everything has shipped / arrived |
| `payment.completed` / `payment.voided` | A payment succeeded / was released |
-| `fulfillment.shipped` / `fulfillment.canceled` | A parcel went out / was stood down |
+| `fulfillment.fulfilled` / `fulfillment.canceled` | A parcel went out / was stood down |
| `product.out_of_stock` / `product.back_in_stock` | Availability flipped |
| `return.received` / `return.refunded` | A return arrived / was refunded |
-| `import.completed` / `export.completed` | Bulk work finished |
+| `import.completed` | An import finished |
+
+For the full list of events and their payloads, see [Webhook Events & Payloads](/api-reference/webhooks-events).
The distinction matters when choosing what to listen for. `order.updated` fires whenever anything about an order changes — including an admin editing a note. `order.placed` fires once, when a customer actually bought something. Sending a confirmation email on the wrong one is how customers receive nine copies.
@@ -61,7 +63,6 @@ An event carries the record it's about, serialized:
{
"id": "or_86Rf07xd4z",
"number": "R123456789",
- "status": "placed",
"payment_status": "paid",
"total": "135.60",
"email": "[email protected]"
@@ -131,7 +132,7 @@ subscribes_to 'order.placed', async: false
```
<Warning>
-A synchronous subscriber runs while the customer waits, and an exception in it can fail their checkout. Reserve it for work that must be atomic with the order, and keep it fast.
+A synchronous subscriber runs while the customer waits, so a slow one slows their checkout. An exception in it is reported to `Rails.error` and swallowed in production, but re-raised in development and test so you notice it. Reserve it for work that must happen immediately, and keep it fast.
</Warning>
## Publishing your own events
diff --git a/docs/developer/core-concepts/freight.mdx b/docs/developer/core-concepts/freight.mdx
index 62fef2810d..d3625fd1dd 100644
--- a/docs/developer/core-concepts/freight.mdx
+++ b/docs/developer/core-concepts/freight.mdx
@@ -14,7 +14,7 @@ Four pieces make that work, and none of them disturb retail shipping:
| Piece | Question it answers |
|---|---|
-| **Carton details** on a product | How do these units pack? |
+| **Carton details** on a variant | How do these units pack? |
| **Freight summary** on a cart or order | How big is the whole load? |
| **Volume and company rules** on a delivery method | Which shipment tier is this? |
| **Unpriced rates** | What does a buyer see before a price exists? |
@@ -35,7 +35,8 @@ weight**.
The geometry lives on a shared carton, because merchants reuse a handful of
standard sizes across hundreds of products and one edit should fix all of
-them. What varies per product stays on the product:
+them. What varies per product is set on each variant (the product's only variant
+for products without options):
| Field | What it says |
|---|---|
diff --git a/docs/developer/core-concepts/fulfillments.mdx b/docs/developer/core-concepts/fulfillments.mdx
index 20eea10869..8ee7fbbf2b 100644
--- a/docs/developer/core-concepts/fulfillments.mdx
+++ b/docs/developer/core-concepts/fulfillments.mdx
@@ -57,7 +57,7 @@ erDiagram
| `delivery_rates` | The options the customer can choose from |
| `selected_delivery_rate_id` | The chosen option |
| `fulfilled_at` | When it went out |
-| `delivered_at` | When the customer got it — what return windows count from |
+| `delivered_at` | When the customer got it |
## Statuses
@@ -104,9 +104,9 @@ only delivered when the third one lands. That rollup is recomputed whenever
deliveries are added, removed or corrected — including when a tracking number
is fixed, which starts that consignment's journey over.
-`delivered_at` is what return windows and the EU withdrawal period count from,
-so it records when the carrier says the parcel arrived rather than when you
-heard about it.
+`delivered_at` records when the carrier says the parcel arrived rather than
+when you heard about it. (The default return window counts from when the order
+was placed, not from delivery — see [returns](/developer/core-concepts/returns-exchanges-claims).)
Carriers report this through their provider's webhook, matched to the delivery
by tracking number. With no carrier integration, staff mark receipt by hand —
@@ -221,11 +221,11 @@ Each fulfillment on a cart offers delivery rates. The customer picks one per ful
const cart = await client.carts.get(cartId)
cart.fulfillments[0].delivery_rates
-// => [{ id: 'rate_xxx', name: 'DHL Express', display_cost: '$12.00',
+// => [{ id: 'dr_xxx', name: 'DHL Express', display_cost: '$12.00',
// estimated_delivery_date: '2026-08-07' }, ...]
await client.carts.fulfillments.update(cartId, cart.fulfillments[0].id, {
- selected_delivery_rate_id: 'rate_xxx',
+ selected_delivery_rate_id: 'dr_xxx',
})
```
@@ -234,7 +234,7 @@ curl -X PATCH 'https://api.mystore.com/api/v3/store/carts/cart_xxx/fulfillments/
-H 'X-Spree-API-Key: pk_xxx' \
-H 'X-Spree-Token: abc123' \
-H 'Content-Type: application/json' \
- -d '{ "selected_delivery_rate_id": "rate_xxx" }'
+ -d '{ "selected_delivery_rate_id": "dr_xxx" }'
```
</CodeGroup>
@@ -295,7 +295,9 @@ await adminClient.orders.fulfillments.markDelivered('or_xxx', 'ful_xxx')
// Split it when only part can go now
await adminClient.orders.fulfillments.split('or_xxx', 'ful_xxx', {
- items: [{ fulfillment_item_id: 'fi_xxx', quantity: 1 }],
+ variant_id: 'variant_xxx',
+ quantity: 1,
+ stock_location_id: 'sloc_xxx', // optional; defaults to the fulfillment's location
})
// Cancel
diff --git a/docs/developer/core-concepts/imports-exports.mdx b/docs/developer/core-concepts/imports-exports.mdx
index 0f9bad233a..465ea903ee 100644
--- a/docs/developer/core-concepts/imports-exports.mdx
+++ b/docs/developer/core-concepts/imports-exports.mdx
@@ -46,8 +46,8 @@ const exportJob = await adminClient.exports.create({
// Poll until it's done
const status = await adminClient.exports.get(exportJob.id)
-status.status // "pending" → "processing" → "completed"
-status.download_url // available once completed
+status.done // true once the file is ready
+status.download_url // available once done
```
```bash CLI
@@ -66,7 +66,7 @@ An export can carry the same filters as the listing it came from, so "export wha
```typescript Admin SDK
await adminClient.exports.create({
type: 'orders',
- filters: { completed_at_gteq: '2026-01-01' },
+ search_params: { completed_at_gteq: '2026-01-01' },
})
```
@@ -74,7 +74,7 @@ await adminClient.exports.create({
curl -X POST 'https://api.mystore.com/api/v3/admin/exports' \
-H 'X-Spree-API-Key: sk_xxx' \
-H 'Content-Type: application/json' \
- -d '{ "type": "orders", "filters": { "completed_at_gteq": "2026-01-01" } }'
+ -d '{ "type": "orders", "search_params": { "completed_at_gteq": "2026-01-01" } }'
```
</CodeGroup>
@@ -115,8 +115,8 @@ Importing has an extra step, because a file from somewhere else won't have Spree
status.status // "processing" → "completed"
status.rows_count // total
- status.processed_count
- status.failed_count
+ status.completed_rows_count
+ status.failed_rows_count
```
</Step>
</Steps>
@@ -176,9 +176,12 @@ Imports and exports emit [events](/developer/core-concepts/events) as they progr
| Event | When |
|---|---|
+| `import.created` | An import has been uploaded |
+| `import.progress` | A batch of rows has been processed |
| `import.completed` | Every row has been attempted |
-| `import.failed` | The import could not run |
-| `export.completed` | The file is ready to download |
+| `export.created` | An export has been requested (generation starts in the background) |
+
+There is no event when an export's file is ready — poll the export until `done` is `true`.
## Permissions
diff --git a/docs/developer/core-concepts/inventory.mdx b/docs/developer/core-concepts/inventory.mdx
index 506a36820c..0f6b498f85 100644
--- a/docs/developer/core-concepts/inventory.mdx
+++ b/docs/developer/core-concepts/inventory.mdx
@@ -257,7 +257,7 @@ await adminClient.stockTransfers.stockReceipts.create(transfer.id, {
curl -X POST 'https://api.mystore.com/api/v3/admin/stock_transfers' \
-H 'X-Spree-API-Key: sk_xxx' \
-H 'Content-Type: application/json' \
- -d '{ "source_location_id": "sl_a", "destination_location_id": "sl_b" }'
+ -d '{ "source_location_id": "sloc_xxx", "destination_location_id": "sloc_yyy" }'
```
</CodeGroup>
@@ -302,7 +302,7 @@ await adminClient.purchaseOrders.stockReceipts.create(order.id, {
curl -X POST 'https://api.mystore.com/api/v3/admin/purchase_orders' \
-H 'X-Spree-API-Key: sk_xxx' \
-H 'Content-Type: application/json' \
- -d '{ "supplier_id": "sup_xxx", "stock_location_id": "sl_xxx" }'
+ -d '{ "supplier_id": "sup_xxx", "destination_location_id": "sloc_xxx" }'
```
</CodeGroup>
diff --git a/docs/developer/core-concepts/media.mdx b/docs/developer/core-concepts/media.mdx
index ad56a02a7a..184d951a7e 100644
--- a/docs/developer/core-concepts/media.mdx
+++ b/docs/developer/core-concepts/media.mdx
@@ -29,7 +29,7 @@ Every file in a store is in the library, whether or not it's currently placed on
const { data: media } = await adminClient.media.list()
// Where is this file being used?
-const { data: usage } = await adminClient.media.usage('med_xxx')
+const { data: usage } = await adminClient.media.usage('media_xxx')
```
```bash cURL
@@ -38,7 +38,7 @@ curl 'https://api.mystore.com/api/v3/admin/media' \
-H 'X-Spree-API-Key: sk_xxx'
# Where is this file being used?
-curl 'https://api.mystore.com/api/v3/admin/media/med_xxx/usage' \
+curl 'https://api.mystore.com/api/v3/admin/media/media_xxx/usage' \
-H 'X-Spree-API-Key: sk_xxx'
```
@@ -61,7 +61,7 @@ Placing a library file on a product creates a **new media row that shares the sa
```typescript Admin SDK
await adminClient.products.media.create('prod_xxx', {
- source_media_id: 'med_xxx',
+ source_media_id: 'media_xxx',
alt: 'Worn over a navy jumper',
position: 2,
})
@@ -71,7 +71,7 @@ await adminClient.products.media.create('prod_xxx', {
curl -X POST 'https://api.mystore.com/api/v3/admin/products/prod_xxx/media' \
-H 'X-Spree-API-Key: sk_xxx' \
-H 'Content-Type: application/json' \
- -d '{ "source_media_id": "med_xxx", "alt": "Worn over a navy jumper", "position": 2 }'
+ -d '{ "source_media_id": "media_xxx", "alt": "Worn over a navy jumper", "position": 2 }'
```
</CodeGroup>
@@ -90,19 +90,19 @@ A file in use can't be deleted by accident:
```typescript Admin SDK
// Returns 422 with the list of places it's used
-await adminClient.media.delete('med_xxx')
+await adminClient.media.delete('media_xxx')
// Remove it from everywhere, then delete
-await adminClient.media.delete('med_xxx', { detach: true })
+await adminClient.media.delete('media_xxx', { detach: true })
```
```bash cURL
# Returns 422 with the list of places it is used
-curl -X DELETE 'https://api.mystore.com/api/v3/admin/media/med_xxx' \
+curl -X DELETE 'https://api.mystore.com/api/v3/admin/media/media_xxx' \
-H 'X-Spree-API-Key: sk_xxx'
# Remove it from everywhere, then delete
-curl -X DELETE 'https://api.mystore.com/api/v3/admin/media/med_xxx?detach=true' \
+curl -X DELETE 'https://api.mystore.com/api/v3/admin/media/media_xxx?detach=true' \
-H 'X-Spree-API-Key: sk_xxx'
```
@@ -290,8 +290,8 @@ const video = await client.products.media.create('prod_86Rf07xd4z', {
```
```bash cURL
-curl -X POST 'https://api.mystore.com/api/v3/store/products/prod_86Rf07xd4z/media' \
- -H 'X-Spree-API-Key: pk_xxx' \
+curl -X POST 'https://api.mystore.com/api/v3/admin/products/prod_86Rf07xd4z/media' \
+ -H 'X-Spree-API-Key: sk_xxx' \
-H 'Content-Type: application/json' \
-d '{
"media_type": "video",
@@ -314,8 +314,8 @@ await client.products.media.update('prod_86Rf07xd4z', 'media_k5nR8xLq', {
```
```bash cURL
-curl -X PATCH 'https://api.mystore.com/api/v3/store/products/prod_86Rf07xd4z/media/media_k5nR8xLq' \
- -H 'X-Spree-API-Key: pk_xxx' \
+curl -X PATCH 'https://api.mystore.com/api/v3/admin/products/prod_86Rf07xd4z/media/media_k5nR8xLq' \
+ -H 'X-Spree-API-Key: sk_xxx' \
-H 'Content-Type: application/json' \
-d '{ "poster_signed_id": "SIGNED_POSTER_BLOB_ID" }'
```
@@ -352,8 +352,8 @@ await client.products.media.update('prod_86Rf07xd4z', 'media_k5nR8xLq', {
```
```bash cURL
-curl -X PATCH 'https://api.mystore.com/api/v3/store/products/prod_86Rf07xd4z/media/media_k5nR8xLq' \
- -H 'X-Spree-API-Key: pk_xxx' \
+curl -X PATCH 'https://api.mystore.com/api/v3/admin/products/prod_86Rf07xd4z/media/media_k5nR8xLq' \
+ -H 'X-Spree-API-Key: sk_xxx' \
-H 'Content-Type: application/json' \
-d '{ "focal_point_x": 0.25, "focal_point_y": 0.4 }'
```
diff --git a/docs/developer/core-concepts/orders.mdx b/docs/developer/core-concepts/orders.mdx
index d70e96fa06..33c32fd22e 100644
--- a/docs/developer/core-concepts/orders.mdx
+++ b/docs/developer/core-concepts/orders.mdx
@@ -144,11 +144,11 @@ await adminClient.orders.cancel('or_grouped_xxx', {
})
// Take an authorized payment
-await adminClient.orders.payments.capture('or_xxx', 'pay_xxx')
+await adminClient.orders.payments.capture('or_xxx', 'py_xxx')
// Refund against a specific payment
await adminClient.orders.refunds.create('or_xxx', {
- payment_id: 'pay_xxx',
+ payment_id: 'py_xxx',
amount: '25.00',
})
```
diff --git a/docs/developer/core-concepts/payments.mdx b/docs/developer/core-concepts/payments.mdx
index cff378e96d..b3c9ff2587 100644
--- a/docs/developer/core-concepts/payments.mdx
+++ b/docs/developer/core-concepts/payments.mdx
@@ -109,7 +109,6 @@ erDiagram
- **Payment Setup Session** manages saving payment methods for future use without an immediate charge (e.g., Stripe SetupIntent)
- **Source** is polymorphic - can be a Credit Card, Payment Source (for alternative methods like Klarna, iDEAL), or Store Credit
- **Gateway Customer** stores the provider-specific customer profile (e.g., Stripe Customer ID)
-- **Log Entries** record gateway responses for debugging
- **Refunds** track money returned to customers
## Payment Methods
@@ -620,7 +619,7 @@ cannot start one from your storefront:
await adminClient.orders.refunds.create(orderId, {
payment_id: 'py_abc123',
amount: '25.00',
- reason_id: 'rr_xyz789',
+ refund_reason_id: 'rr_xyz789',
})
```
diff --git a/docs/developer/core-concepts/products.mdx b/docs/developer/core-concepts/products.mdx
index 0012e932a2..760479975d 100644
--- a/docs/developer/core-concepts/products.mdx
+++ b/docs/developer/core-concepts/products.mdx
@@ -51,12 +51,12 @@ erDiagram
OptionType {
string name
- string presentation
+ string label
}
OptionValue {
string name
- string presentation
+ string label
}
```
@@ -646,9 +646,9 @@ erDiagram
```typescript Admin SDK
const shoes = await adminClient.productTypes.create({
name: 'Footwear',
- option_type_ids: ['optt_size', 'optt_color'],
+ option_type_ids: ['opt_size', 'opt_color'],
category_ids: ['ctg_footwear'],
- delivery_profile_id: 'dp_standard',
+ delivery_profile_id: 'fp_standard',
custom_field_definitions: [
{ id: 'cfdef_material', required: true, sort_order: 0 },
],
@@ -667,9 +667,9 @@ curl -X POST 'https://api.mystore.com/api/v3/admin/product_types' \
-H 'Content-Type: application/json' \
-d '{
"name": "Footwear",
- "option_type_ids": ["optt_size", "optt_color"],
+ "option_type_ids": ["opt_size", "opt_color"],
"category_ids": ["ctg_footwear"],
- "delivery_profile_id": "dp_standard"
+ "delivery_profile_id": "fp_standard"
}'
```
diff --git a/docs/developer/core-concepts/reporting.mdx b/docs/developer/core-concepts/reporting.mdx
index bebde599bf..6539cedc72 100644
--- a/docs/developer/core-concepts/reporting.mdx
+++ b/docs/developer/core-concepts/reporting.mdx
@@ -64,16 +64,17 @@ without a dashboard change.
## Metrics
-A metric is an aggregate over one **base** relation. Core registers four, in
-three families:
+A metric is an aggregate over one **base** relation. Core registers five, in
+four families:
| Family | Bases | Anchored on |
|--------|-------|-------------|
| `sales` | `:orders`, `:line_items` | when the order completed |
| `payments` | `:payments` | when the payment was taken |
| `inventory` | `:stock_movements` | when the stock moved |
+| `carts` | `:carts` | when the cart was started |
-A query draws from **one family only**. The three answer different questions on
+A query draws from **one family only**. The families answer different questions on
different clocks, so a payment total beside a units-received count is two
reports wearing one table — the query refuses the mix rather than inventing a
join between grains that have no honest relationship.
diff --git a/docs/developer/core-concepts/returns-exchanges-claims.mdx b/docs/developer/core-concepts/returns-exchanges-claims.mdx
index 21d18c2900..af5ebb1272 100644
--- a/docs/developer/core-concepts/returns-exchanges-claims.mdx
+++ b/docs/developer/core-concepts/returns-exchanges-claims.mdx
@@ -57,7 +57,7 @@ Customers can open a return or a claim on their own order and follow its progres
// Request a return — items refer to units that shipped, not cart line items
const returnRequest = await client.orders.returns.create('or_xxx', {
items: [{ fulfillment_item_id: 'fi_xxx', quantity: 1 }],
- reason_id: 'rsn_xxx',
+ reason_id: 'rar_xxx',
memo: 'Too small',
})
@@ -82,7 +82,7 @@ curl -X POST 'https://api.mystore.com/api/v3/store/orders/or_xxx/returns' \
</CodeGroup>
-Claim types are `damaged`, `missing`, `wrong_item` and `other` out of the box, and a store can add its own.
+Claim reasons are records each store owns. New stores are seeded with *Arrived damaged*, *Never arrived*, *Wrong item sent*, *Missing item from order* and *Item not as described*, and merchants can add, rename or remove their own.
## Processing a return
@@ -172,9 +172,9 @@ What to do about a claim is decided when you resolve it, not when the customer o
<CodeGroup>
```typescript Admin SDK
-await adminClient.orders.claims.approve('or_xxx', 'clm_xxx')
+await adminClient.orders.claims.approve('or_xxx', 'claim_xxx')
-await adminClient.orders.claims.resolve('or_xxx', 'clm_xxx', {
+await adminClient.orders.claims.resolve('or_xxx', 'claim_xxx', {
resolution: 'refund_and_replacement', // or 'refund', 'replacement'
refund_method: 'store_credit',
replacement_line_item_ids: ['li_xxx'],
@@ -182,10 +182,10 @@ await adminClient.orders.claims.resolve('or_xxx', 'clm_xxx', {
```
```bash cURL
-curl -X PATCH 'https://api.mystore.com/api/v3/admin/orders/or_xxx/claims/clm_xxx/approve' \
+curl -X PATCH 'https://api.mystore.com/api/v3/admin/orders/or_xxx/claims/claim_xxx/approve' \
-H 'X-Spree-API-Key: sk_xxx'
-curl -X PATCH 'https://api.mystore.com/api/v3/admin/orders/or_xxx/claims/clm_xxx/resolve' \
+curl -X PATCH 'https://api.mystore.com/api/v3/admin/orders/or_xxx/claims/claim_xxx/resolve' \
-H 'X-Spree-API-Key: sk_xxx' \
-H 'Content-Type: application/json' \
-d '{
@@ -252,7 +252,7 @@ curl 'https://api.mystore.com/api/v3/admin/claims?q[created_at_gt]=2026-08-01' \
## Return policy
-Spree ships no built-in return window. Whether a customer may open a return is store policy, and it's checked when the return is created — so you can hold customers to a 30-day window while letting staff make an exception for a good customer, and vary the rule by market where local law requires it.
+Spree ships one built-in rule: a return window, counted from when the order was placed and set per market (30 days by default). Whether a customer may open a return is store policy, and it's checked when the return is created — so you can hold customers to that window while letting staff make an exception for a good customer, and vary the rule by market where local law requires it.
Set the return window per market, or express a more specific rule in your own application. See [Configuration](/developer/customization/configuration) and [Services & Workflows](/developer/customization/workflows).
diff --git a/docs/developer/core-concepts/search-filtering.mdx b/docs/developer/core-concepts/search-filtering.mdx
index bbd3007f35..090e3eeeb4 100644
--- a/docs/developer/core-concepts/search-filtering.mdx
+++ b/docs/developer/core-concepts/search-filtering.mdx
@@ -193,7 +193,7 @@ const filters = await client.products.filters()
// filters: [
// { id: 'price', type: 'price_range', min: 9.99, max: 199.99, currency: 'USD' },
// { id: 'availability', type: 'availability', options: [{ id: 'in_stock', count: 42 }, { id: 'out_of_stock', count: 3 }] },
-// { id: 'optt_xxx', type: 'option', name: 'size', label: 'Size', kind: 'dropdown', options: [{ id: 'optval_xxx', name: 'Small', label: 'Small', position: 1, color_code: null, image_url: null, count: 12 }] },
+// { id: 'opt_xxx', type: 'option', name: 'size', label: 'Size', kind: 'dropdown', options: [{ id: 'optval_xxx', name: 'Small', label: 'Small', position: 1, color_code: null, image_url: null, count: 12 }] },
// { id: 'categories', type: 'category', options: [{ id: 'ctg_xxx', name: 'Clothing', permalink: 'clothing', count: 45 }] },
// ],
// sort_options: [{ id: 'manual' }, { id: 'price' }, { id: '-price' }],
@@ -294,10 +294,10 @@ See [Querying](/api-reference/store-api/querying) for the full list of filtering
## Search Providers
-Spree uses a pluggable search provider architecture. The default provider uses SQL (ILIKE + Ransack). For production catalogs with 1,000+ products, we recommend switching to [Meilisearch](/integrations/search/meilisearch) for typo tolerance, relevance ranking, and faster faceted search.
+Spree uses a pluggable search provider architecture. The default provider uses SQL (ILIKE + Ransack). For production catalogs with 1,000+ products, we recommend installing the `spree_meilisearch` gem and switching to [Meilisearch](/integrations/search/meilisearch) for typo tolerance, relevance ranking, and faster faceted search.
```ruby server/config/initializers/spree.rb
-Spree.search_provider = 'Spree::SearchProvider::Meilisearch'
+Spree.search_provider = 'SpreeMeilisearch::SearchProvider'
```
No client-side or API changes are needed — the same `q[search]`, filter params, and sort options work with any provider.
diff --git a/docs/developer/core-concepts/sellers.mdx b/docs/developer/core-concepts/sellers.mdx
index cd50a046ae..47e2d06cd5 100644
--- a/docs/developer/core-concepts/sellers.mdx
+++ b/docs/developer/core-concepts/sellers.mdx
@@ -101,10 +101,10 @@ await adminClient.sellers.suspend('sel_xxx', { reason: 'Unresolved delivery comp
curl -X POST 'https://api.mystore.com/api/v3/admin/sellers/sel_xxx/invite' \
-H 'X-Spree-API-Key: sk_xxx'
-curl -X POST 'https://api.mystore.com/api/v3/admin/sellers/sel_xxx/approve' \
+curl -X PATCH 'https://api.mystore.com/api/v3/admin/sellers/sel_xxx/approve' \
-H 'X-Spree-API-Key: sk_xxx'
-curl -X POST 'https://api.mystore.com/api/v3/admin/sellers/sel_xxx/suspend' \
+curl -X PATCH 'https://api.mystore.com/api/v3/admin/sellers/sel_xxx/suspend' \
-H 'X-Spree-API-Key: sk_xxx' \
-H 'Content-Type: application/json' \
-d '{ "reason": "Unresolved delivery complaints" }'
@@ -215,7 +215,7 @@ curl -X POST 'https://marketplace.example.com/api/v3/seller/products' \
-H 'Content-Type: application/json' \
-d '{ "name": "Handmade Vase" }'
-curl -X POST 'https://marketplace.example.com/api/v3/seller/products/prod_xxx/submit' \
+curl -X PATCH 'https://marketplace.example.com/api/v3/seller/products/prod_xxx/submit' \
-H 'Authorization: Bearer $SELLER_JWT' \
-H 'X-Spree-Seller-Id: sel_xxx'
```
diff --git a/docs/developer/core-concepts/staff-roles.mdx b/docs/developer/core-concepts/staff-roles.mdx
index 2363fd2380..963cbd468a 100644
--- a/docs/developer/core-concepts/staff-roles.mdx
+++ b/docs/developer/core-concepts/staff-roles.mdx
@@ -219,9 +219,11 @@ The invitation system publishes [events](/developer/core-concepts/events) you ca
## Permissions
-Spree uses [CanCanCan](https://github.com/CanCanCommunity/cancancan) for authorization. Permissions apply to both customers (Store API access) and admins (Admin Panel access).
+A role holds flat permission keys from one catalog (`read_orders`, `write_products`, …) — the same vocabulary as secret API key scopes. Every Admin API request checks the staff member's keys on the current store against the endpoint's `read_<resource>` / `write_<resource>` key and returns `403` with `details.required_permission` when it is missing. Staff endpoints (`/admin_users`, `/invitations`, `/roles`) need `read_staff` / `write_staff`.
-See the [Customize Permissions guide](/developer/customization/permissions) for details on creating custom roles and permission sets.
+Permissions apply to staff only. Customers never hold roles: the Store API authorizes them by ownership-scoped queries plus `Spree::Storefront::AccessPolicy`.
+
+See the [Customize Permissions guide](/developer/customization/permissions) for details on creating custom roles and registering your own permission keys.
## Related Documentation
diff --git a/docs/developer/core-concepts/store-credits-gift-cards.mdx b/docs/developer/core-concepts/store-credits-gift-cards.mdx
index 2b795b7eb9..0c8969ac2b 100644
--- a/docs/developer/core-concepts/store-credits-gift-cards.mdx
+++ b/docs/developer/core-concepts/store-credits-gift-cards.mdx
@@ -18,7 +18,7 @@ Spree provides two stored value mechanisms that customers can use at checkout:
| Has code | No | Yes |
| Created by | Admin | Admin |
| Assignment | Directly to customer | Applied to order via code |
-| Expiration | Configurable by type | Configurable per card |
+| Expiration | Never expire | Optional, per card |
## Store Credits
diff --git a/docs/developer/core-concepts/stores.mdx b/docs/developer/core-concepts/stores.mdx
index c9ccf6091c..f17d1c9b81 100644
--- a/docs/developer/core-concepts/stores.mdx
+++ b/docs/developer/core-concepts/stores.mdx
@@ -5,7 +5,7 @@ description: Understand Spree Stores — the top-level tenant boundary that scop
## Overview
-The Store is the top-level tenant in Spree. Every resource — products, orders, channels, markets, taxonomies — belongs to exactly one store. A store owns its [channels](/developer/core-concepts/channels) (online, POS, wholesale, …), its [markets](/developer/core-concepts/markets) (region/currency/locale), and its [product catalog](/developer/core-concepts/products).
+The Store is the top-level tenant in Spree. Every resource — products, orders, channels, markets, categories — belongs to exactly one store. A store owns its [channels](/developer/core-concepts/channels) (online, POS, wholesale, …), its [markets](/developer/core-concepts/markets) (region/currency/locale), and its [product catalog](/developer/core-concepts/products).
```mermaid
erDiagram
@@ -87,7 +87,7 @@ The store sets the fallback for **storefront access gating** — whether anonymo
## Store Resources
-Each store owns its own resources. Products, orders, channels, markets, and taxonomies in one store are independent from another.
+Each store owns its own resources. Products, orders, channels, markets, and categories in one store are independent from another.
| Resource | Relationship |
|----------|-------------|
diff --git a/docs/developer/core-concepts/translations.mdx b/docs/developer/core-concepts/translations.mdx
index 98f26fc561..fdb9ea7abf 100644
--- a/docs/developer/core-concepts/translations.mdx
+++ b/docs/developer/core-concepts/translations.mdx
@@ -91,27 +91,31 @@ Responses vary by locale, so if you cache them, include the locale in the cache
Merchants translate in the dashboard, switching locale on the record they're editing. For bulk work — handing a catalogue to a translation agency — export to CSV, translate, and import it back.
-Translations can also be written through the Admin API, which is what you'd use to sync from an external translation service:
+Translations can also be written through the Admin API, which is what you'd use to sync from an external translation service. Writes go through one batch endpoint — every entry succeeds or none do — so a product and its option values can be translated in a single request:
<CodeGroup>
```typescript Admin SDK
-await adminClient.products.update('prod_xxx', {
- translations: {
- fr: { name: 'Sac Spree', description: 'Un sac fourre-tout élégant…' },
- de: { name: 'Spree Tasche' },
+await adminClient.translations.batch([
+ {
+ resource_type: 'product',
+ resource_id: 'prod_xxx',
+ values: {
+ fr: { name: 'Sac Spree', description: 'Un sac fourre-tout élégant…' },
+ de: { name: 'Spree Tasche' },
+ },
},
-})
+])
// Which resources and fields accept translations
const { data: resources } = await adminClient.translatableResources.list()
```
```bash cURL
-curl -X PATCH 'https://api.mystore.com/api/v3/admin/products/prod_xxx' \
+curl -X POST 'https://api.mystore.com/api/v3/admin/translations/batch' \
-H 'X-Spree-API-Key: sk_xxx' \
-H 'Content-Type: application/json' \
- -d '{ "translations": { "de": { "name": "Baumwolltasche" } } }'
+ -d '{ "translations": [ { "resource_type": "product", "resource_id": "prod_xxx", "values": { "de": { "name": "Baumwolltasche" } } } ] }'
```
</CodeGroup>
diff --git a/docs/developer/core-concepts/webhooks.mdx b/docs/developer/core-concepts/webhooks.mdx
index 4776112371..e8ed993a99 100644
--- a/docs/developer/core-concepts/webhooks.mdx
+++ b/docs/developer/core-concepts/webhooks.mdx
@@ -12,7 +12,7 @@ Webhooks are built on top of Spree's [event system](/developer/core-concepts/eve
- **Multi-store support** - Each store has its own webhook endpoints
- **Event filtering** - Subscribe to specific events or patterns with wildcards
- **Secure delivery** - HMAC-SHA256 signatures for payload verification
-- **Automatic retries** - Failed deliveries retry with exponential backoff
+- **Failure handling** - Failed deliveries are recorded and can be re-sent, and an endpoint that keeps failing is disabled
- **Full audit trail** - Track every delivery attempt with response codes and timing
## How Webhooks Work
@@ -34,10 +34,9 @@ flowchart LR
subgraph External Service
H --> I{Response}
- I -->|2xx| J[Success]
- I -->|Error| K[Retry with Backoff]
- K -->|Max Retries| L[Mark Failed]
- K -->|Retry| H
+ I -->|2xx| J[Mark Successful]
+ I -->|Error| K[Mark Failed]
+ K -->|15 failures in a row| L[Disable Endpoint]
end
```
@@ -51,7 +50,7 @@ flowchart LR
### Via Admin Panel
-Navigate to **Settings → Developers → Webhooks** in the admin panel to create and manage webhook endpoints.
+Navigate to **Settings → Developer → Webhooks** in the admin panel to create and manage webhook endpoints.
### Via the Admin API
@@ -145,7 +144,7 @@ The `subscriptions` array accepts exact event names and wildcard patterns:
| `['order.placed', 'order.canceled']` | Only those two events |
| `['order.*']` | All order events |
| `['*.created']` | All creation events |
-| `['order.*', 'payment.*', 'shipment.shipped']` | Multiple patterns |
+| `['order.*', 'payment.*', 'fulfillment.fulfilled']` | Multiple patterns |
| `[]` or `['*']` | All events |
## Webhook Payload
@@ -160,7 +159,7 @@ Each webhook delivery sends a JSON payload with the following structure. The `da
"data": {
"id": "or_m3Rp9wXz",
"number": "R123456789",
- "fulfillment_status": "shipped",
+ "fulfillment_status": "unfulfilled",
"payment_status": "paid",
"total": "99.99",
"display_total": "$99.99",
@@ -171,7 +170,7 @@ Each webhook delivery sends a JSON payload with the following structure. The `da
"payments": [ ... ]
},
"metadata": {
- "spree_version": "5.1.0"
+ "spree_version": "6.0.0"
}
}
```
@@ -249,7 +248,7 @@ class WebhooksController < ApplicationController
case event['name']
when 'order.placed'
- handle_order_completed(event['data'])
+ handle_order_placed(event['data'])
when 'product.updated'
handle_product_updated(event['data'])
end
@@ -272,11 +271,13 @@ class WebhooksController < ApplicationController
end
```
-## Delivery Status & Retries
+## Delivery Status
-### Automatic Retries
+### Failed Deliveries
-Failed webhook deliveries automatically retry up to 5 times with exponential backoff. This handles temporary network issues and endpoint downtime.
+Spree sends each delivery once. Any response other than 2xx — including a timeout or a connection error — marks the delivery as failed, and Spree does not send it again on its own. To send a failed delivery again, re-send it from the delivery log (see below).
+
+If an endpoint fails 15 deliveries in a row, Spree disables it and emails the store staff. Fix the endpoint, then turn it back on by marking it active again.
### Checking Delivery Status
@@ -329,7 +330,7 @@ SSL certificates are verified in production, and not in development — so you c
## Available Events
-Webhooks can subscribe to any event in Spree's event system. See [Events](/developer/core-concepts/events#available-events) for a complete list.
+Webhooks can subscribe to any event in Spree's event system. See [Webhook Events & Payloads](/api-reference/webhooks-events) for the complete list.
Common webhook events include:
@@ -338,12 +339,12 @@ Common webhook events include:
| `order.placed` | A customer completed checkout |
| `order.paid` | The order is fully paid |
| `order.canceled` | The order was canceled |
-| `order.shipped` | Everything on the order has shipped |
-| `fulfillment.shipped` | One parcel went out |
+| `order.fulfilled` | Everything on the order has shipped |
+| `fulfillment.fulfilled` | One parcel went out |
| `payment.completed` | A payment succeeded |
| `product.created` / `product.updated` | Catalog changes |
| `product.out_of_stock` / `product.back_in_stock` | Availability flipped |
-| `customer.created` | A new customer registered |
+| `user.created` | A new customer registered |
| `return.received` | A return arrived |
## Testing Webhooks
@@ -401,7 +402,7 @@ curl -X POST 'https://api.mystore.com/api/v3/admin/webhook_endpoints' \
</Card>
<Card title="Handle duplicates" icon="copy">
- Use the event `id` to detect and handle duplicate deliveries. Webhooks may be retried.
+ Use the event `id` to detect and handle duplicate deliveries. A delivery that is re-sent carries the same event `id`.
</Card>
<Card title="Subscribe selectively" icon="filter">
diff --git a/docs/developer/create-spree-app/quickstart.mdx b/docs/developer/create-spree-app/quickstart.mdx
index 55d8003a21..c13ab7cf76 100644
--- a/docs/developer/create-spree-app/quickstart.mdx
+++ b/docs/developer/create-spree-app/quickstart.mdx
@@ -127,14 +127,9 @@ The project includes [@spree/cli](/developer/cli/quickstart) for managing your S
### Admin Dashboard
-Open [http://localhost:3000/admin](http://localhost:3000/admin) and log in with:
+The dashboard runs as its own dev server: `spree dev` starts it alongside the API at [http://localhost:5173](http://localhost:5173), live-reloading from `apps/dashboard/`. See the [dashboard docs](/developer/dashboard/overview).
-| | |
-|---|---|
-| **Email** | `[email protected]` |
-| **Password** | `spree123` |
-
-The dashboard runs as its own dev server: `spree dev` starts it alongside the API at [http://localhost:5173](http://localhost:5173), with the same credentials, live-reloading from `apps/dashboard/`. See the [dashboard docs](/developer/dashboard/overview).
+No default admin account is created. On the first run, `spree dev` opens a one-time setup link where you create the admin account. If you missed it, print it again with `spree rails spree:setup:token`.
### Store API
diff --git a/docs/developer/customization/api.mdx b/docs/developer/customization/api.mdx
index 9bb1541878..0c4851bbc8 100644
--- a/docs/developer/customization/api.mdx
+++ b/docs/developer/customization/api.mdx
@@ -141,7 +141,7 @@ The base `ResourceController` provides:
| Pagination | [Pagy](https://github.com/ddnexus/pagy) — `?page=2&limit=25` |
| Filtering | [Ransack](https://github.com/activerecord-hackery/ransack) — `?q[name_cont]=nike` |
| Sorting | JSON:API style — `?sort=-name` |
-| Authorization | [CanCanCan](https://github.com/CanCanCommunity/cancancan) |
+| Authorization | Ownership scoping — `scope` decides what the caller can see (Admin API controllers add the `scoped_resource` permission gate) |
| Prefixed IDs | Stripe-style — `brand_k5nR8xLq` |
Override these methods to customize:
diff --git a/docs/developer/customization/checkout.mdx b/docs/developer/customization/checkout.mdx
index 9cd8dd8010..3499adbc01 100644
--- a/docs/developer/customization/checkout.mdx
+++ b/docs/developer/customization/checkout.mdx
@@ -36,7 +36,7 @@ Spree::Checkout::Registry.add_requirement(
step: :address,
field: :vat_number,
message: 'VAT number is required for business orders',
- satisfied: ->(cart) { cart.custom_fields['vat_number'].present? }
+ satisfied: ->(cart) { cart.metadata['vat_number'].present? }
)
```
@@ -60,7 +60,7 @@ A step bundles its own requirements and says when it is satisfied:
Spree::Checkout::Registry.register_step(
name: :loyalty,
before: :payment,
- satisfied: ->(cart) { cart.custom_fields['loyalty_number'].present? },
+ satisfied: ->(cart) { cart.metadata['loyalty_number'].present? },
requirements: ->(cart) {
[{ step: 'loyalty', field: 'loyalty_number',
message: 'Loyalty number is required' }]
diff --git a/docs/developer/customization/dependencies.mdx b/docs/developer/customization/dependencies.mdx
index c1b7dcc2c6..ed9da35e99 100644
--- a/docs/developer/customization/dependencies.mdx
+++ b/docs/developer/customization/dependencies.mdx
@@ -6,8 +6,8 @@ section: customization
## Overview
With Dependencies, you can replace parts of Spree core with your custom code:
-[Services and Workflows](/developer/customization/workflows), CanCanCan
-Abilities (used for [Permissions](/developer/customization/permissions)), and API Serializers (used for
+[Services and Workflows](/developer/customization/workflows), the staff ability class
+and the storefront access policy (used for [Permissions](/developer/customization/permissions)), and API Serializers (used for
generating JSON API responses).
<Tip>
@@ -20,19 +20,19 @@ instead. Hooks survive upgrades.
## Application (global) customization
-This will change every aspect of the application (both APIs, Admin Panel, and Storefront).
+This will change every aspect of the application (the Store API, the Admin API, and everything built on them).
In your `config/initializers/spree.rb` file, you can set the following:
```ruby
-Spree.cart_update_service = MyStore::CartUpdate
+Spree.carts_update_service = MyStore::CartUpdate
```
or using the block syntax:
```ruby
Spree.dependencies do |dependencies|
- dependencies.cart_update_service = MyStore::CartUpdate
+ dependencies.carts_update_service = MyStore::CartUpdate
end
```
@@ -90,6 +90,20 @@ reasons people replace this class, and they don't need maintaining across
upgrades.
</Note>
+<Warning>
+A subclass runs its hooks under its **own** key, derived from its class name —
+`MyStore::AddItem` fires `my_store.add_item.*`, not `carts.add_item.*`. Hooks
+registered on the original key (by you or by an installed extension) stop
+firing once you swap the class in. To keep them, declare the original key in
+the subclass:
+
+```ruby
+class AddItem < Spree::Carts::AddItem
+ workflow_key 'carts.add_item'
+end
+```
+</Warning>
+
## Using dependencies in your code
When you need to use a dependency in your code, you can access it directly via the `Spree` module:
@@ -99,60 +113,53 @@ When you need to use a dependency in your code, you can access it directly via t
Spree.cart_add_item_workflow.call(cart: cart, variant: variant, quantity: 1)
# For API dependencies, use the Spree.api accessor
-Spree.api.storefront_cart_serializer.new(order).serializable_hash
+Spree.api.cart_serializer.new(cart).serializable_hash
```
## Controller level customization
-If you need to replace [serializers](https://github.com/jsonapi-serializer/jsonapi-serializer) or Services in a specific API endpoint you can create a [code decorator](/developer/customization/decorators):
+If you need to replace a serializer in a specific API endpoint only, you can create a [code decorator](/developer/customization/decorators):
```bash
-mkdir -p app/controllers/spree && touch app/controllers/spree/cart_controller_decorator.rb
+mkdir -p app/controllers/spree/api/v3/store && touch app/controllers/spree/api/v3/store/carts_controller_decorator.rb
```
and add the following code to it:
```ruby
module Spree
- module CartControllerDecorator
- def resource_serializer
- MyNewAwesomeCartSerializer
- end
-
- def add_item_service
- MyNewAwesomeAddItemToCart
+ module Api
+ module V3
+ module Store
+ module CartsControllerDecorator
+ def serializer_class
+ MyNewAwesomeCartSerializer
+ end
+ end
+
+ CartsController.prepend(CartsControllerDecorator)
+ end
end
end
-
- CartController.prepend(CartControllerDecorator)
end
```
-This will change the serializer in this API endpoint to `MyNewAwesomeCartSerializer` and also it will swap the default `add_item_service` to `MyNewAwesomeAddItemToCart`.
+This will change the serializer in this API endpoint to `MyNewAwesomeCartSerializer`. Services and workflows are resolved through the global dependencies (e.g. `Spree.cart_add_item_workflow`), so swap those at the application level.
-Different API endpoints can have different dependency injection points. You can review their [source code](https://github.com/spree/spree/tree/main/api/app/controllers/spree/api/v3) to see what you can replace.
+Different API endpoints can have different dependency injection points. You can review their [source code](https://github.com/spree/spree/tree/main/spree/api/app/controllers/spree/api/v3) to see what you can replace.
## API level customization
-Storefront API and Platform API have separate Dependencies injection points so you can easily customize one without touching the other.
+API serializers have their own injection points under `Spree.api` — Store API serializers (`cart_serializer`, `product_serializer`, …) and Admin API serializers (`admin_order_serializer`, …) — so you can customize one surface without touching the other.
In your Spree initializer (`config/initializers/spree.rb`) please add:
```ruby
-Spree.api.storefront_cart_serializer = MyNewAwesomeCartSerializer
-Spree.api.storefront_cart_add_item_service = MyNewAwesomeAddItemToCart
-```
-
-This will swap the default Cart serializer and Add Item to Cart service for your custom ones within all Storefront API endpoints that use those classes.
-
-You can mix and match both global and API-level customizations:
-
-```ruby
-Spree.cart_add_item_workflow = MyNewAwesomeAddItemToCart
-Spree.api.storefront_cart_add_item_service = AnotherAddItemToCart
+Spree.api.cart_serializer = MyNewAwesomeCartSerializer
+Spree.api.admin_order_serializer = MyNewAwesomeAdminOrderSerializer
```
-The second line will have precedence over the first one, and the Storefront API will use `AnotherAddItemToCart` and the rest of the application will use `MyNewAwesomeAddItemToCart`.
+This will swap the default serializers for your custom ones within all API endpoints that use them.
## Debugging dependencies
@@ -174,8 +181,8 @@ cart_recalculate_workflow Spree::Carts::Recalculate [OVERRIDDEN]
...
[API]
-storefront_cart_serializer Spree::V2::Storefront::CartSerializer
-storefront_cart_add_item_service MyApp::CartAddItem [OVERRIDDEN]
+cart_serializer Spree::Api::V3::CartSerializer
+product_serializer MyApp::ProductSerializer [OVERRIDDEN]
...
```
@@ -198,7 +205,7 @@ This shows only the dependencies that have been customized, along with their ori
cart_recalculate_workflow Spree::Carts::Recalculate -> MyApp::CartRecalculate (config/initializers/spree.rb:15)
[API OVERRIDES]
-storefront_cart_add_item_service Spree::Carts::AddItem -> MyApp::CartAddItem (config/initializers/spree.rb:20)
+product_serializer Spree::Api::V3::ProductSerializer -> MyApp::ProductSerializer (config/initializers/spree.rb:20)
```
### Validate all dependencies
@@ -247,11 +254,16 @@ Seams backed by a [workflow](/developer/customization/workflows) use a
| `cart_add_item_service` | `cart_add_item_workflow` |
| `cart_recalculate_service` | `cart_recalculate_workflow` |
| `carts_complete_service` | `carts_complete_workflow` |
+| `carts_upsert_items_service` | `cart_upsert_items_workflow` |
| `cart_merge_strategy` | `cart_merge_workflow` |
| `order_cancel_service` | `order_cancel_workflow` |
| `order_complete_service` | `order_complete_workflow` |
| `fulfillment_create_service` | `fulfillment_create_workflow` |
| `payments_handle_webhook_service` | `payments_handle_webhook_workflow` |
+| `shipment_update_service`, `fulfillment_update_service` | `fulfillment_update_workflow` |
+| `gift_card_apply_service` | `gift_card_apply_workflow` |
+| `gift_card_remove_service` | `gift_card_remove_workflow` |
+| `gift_card_redeem_service` | `gift_card_redeem_workflow` |
<Warning>
The legacy names stay readable, but **assigning to one no longer has any
@@ -264,6 +276,12 @@ If you override any of these, move to the `*_workflow` name and make sure your
class subclasses the workflow.
</Warning>
+Two seams are plain renames with an unchanged contract, so an override set
+under the old name is still applied (with a deprecation warning):
+`checkout_add_store_credit_service` → `store_credit_apply_service` and
+`checkout_remove_store_credit_service` → `store_credit_remove_service`. All
+legacy names are removed in Spree 6.1.
+
## Backwards compatibility
The legacy string-based syntax is still supported for backwards compatibility:
@@ -286,5 +304,5 @@ Default values can be easily checked by:
1. Using the rake task: `bin/rake spree:dependencies:list`
2. Looking at the source code:
- * [Application (global) dependencies](https://github.com/spree/spree/blob/main/core/lib/spree/core/dependencies.rb)
- * [API level dependencies](https://github.com/spree/spree/blob/main/api/lib/spree/api/dependencies.rb)
+ * [Application (global) dependencies](https://github.com/spree/spree/blob/main/spree/core/lib/spree/core/dependencies.rb)
+ * [API level dependencies](https://github.com/spree/spree/blob/main/spree/api/lib/spree/api/dependencies.rb)
diff --git a/docs/developer/customization/permissions.mdx b/docs/developer/customization/permissions.mdx
index 4f1e327e78..e86d827c19 100644
--- a/docs/developer/customization/permissions.mdx
+++ b/docs/developer/customization/permissions.mdx
@@ -11,7 +11,7 @@ Every grantable capability is a flat key of the form `read_<resource>` or `write
Keys are per resource, not per action. The money-adjacent areas (`payments`, `refunds`, `gift_cards`, `store_credits`) are separate resources from `orders`, so "view orders but don't refund" needs no special casing.
-Roles are data, so create them where you manage the rest of your store's data: **Settings → Staff → Roles** in the dashboard, or the Admin API when you want it scripted.
+Roles are data, so create them where you manage the rest of your store's data: **Settings → Roles** in the dashboard, or the Admin API when you want it scripted.
```bash
spree api post roles --data '{
@@ -68,6 +68,6 @@ The catalog is deliberately flat: it answers "may this role touch this kind of r
## How enforcement works
-Every Admin API controller declares its resource (`scoped_resource :orders`). Each request checks the principal's keys — a staff member's role permissions on the current store, or a secret key's scopes — against `read_<resource>` or `write_<resource>` for the action. A missing key produces a 403 naming it in `details.required_permission`. Behind that gate, keys compile to CanCanCan rules for record-level concerns, and `GET /api/v3/admin/me` returns both the rule dump the dashboard mirrors and `permission_keys`, the flat key list.
+Every Admin API controller declares its resource (`scoped_resource :orders`). Each request checks the principal's keys — a staff member's role permissions on the current store, or a secret key's scopes — against `read_<resource>` or `write_<resource>` for the action. A missing key produces a 403 naming it — `details.required_permission` for staff, `details.required_scope` for a secret key. Behind that gate, keys compile to CanCanCan rules for record-level concerns, and `GET /api/v3/admin/me` returns both the rule dump the dashboard mirrors and `permission_keys`, the flat key list.
Storefront customers are not part of this system — customer authorization is ownership, enforced by the Store API's scoped lookups, with nothing to configure. The one swappable piece is `Spree::Storefront::AccessPolicy` (via `Spree::Dependencies.storefront_access_policy_class`): a generic `readable?` / `writable?` / `scope` protocol that defaults to "the caller owns the record", with carts and orders adding guest-token access. Replace it only when access must widen beyond the owner, such as company accounts sharing purchases or wishlists.
diff --git a/docs/developer/dashboard/concepts.mdx b/docs/developer/dashboard/concepts.mdx
index 2b74f3d4ec..7f882680fa 100644
--- a/docs/developer/dashboard/concepts.mdx
+++ b/docs/developer/dashboard/concepts.mdx
@@ -55,7 +55,7 @@ The facade `defineDashboardPlugin({ nav, routes, slots, … })` groups all five
The signed-in admin's identity and abilities are exposed via three providers wrapping the app:
- `<AuthProvider>` — the current admin user; `useAuth()` returns `{ user, signIn, signOut, … }`
-- `<PermissionProvider>` — CanCanCan abilities; `usePermissions()` returns `{ permissions, rules, isLoading }`, and the checks live on `permissions.can(...)`
+- `<PermissionProvider>` — the admin's permissions on the current store; `usePermissions()` returns `{ permissions, rules, permissionKeys, isLoading, refresh }`, and the checks live on `permissions.can(...)`
- `<StoreProvider>` — current store + timezone + currency; `useStore()` returns `{ storeId, store, … }`
When you write a custom page or hook, pull from these. **Never reach into local state for identity** — it changes on store switch or session refresh, and the providers wire all that for you.
diff --git a/docs/developer/dashboard/customization/navigation.mdx b/docs/developer/dashboard/customization/navigation.mdx
index 4287d9269b..8ffbdca9f9 100644
--- a/docs/developer/dashboard/customization/navigation.mdx
+++ b/docs/developer/dashboard/customization/navigation.mdx
@@ -24,7 +24,7 @@ nav.add({
path: '/analytics', // prefixed with /$storeId at render time
icon: BarChartIcon,
position: 650,
- subject: 'Spree::Order', // optional CanCanCan subject — hides item without read permission
+ subject: 'Spree::Order', // optional permission subject — hides item without read permission
})
```
@@ -51,6 +51,7 @@ defineDashboardPlugin({
nav.add({
key: 'analytics',
label: 'Analytics',
+ path: '/analytics', // required, even on a parent
icon: BarChartIcon,
position: 650,
children: [
@@ -198,7 +199,7 @@ settingsNav.add({
## Permission gating
-`subject` on a nav entry checks `permissions.can('read', subject)` — when it fails, the sidebar item is hidden. **This is UX, not authorization.** The backend still enforces CanCanCan via `authorize!` on every API call. Hiding the link is a hint, not a security boundary.
+`subject` on a nav entry checks `permissions.can('read', subject)` — when it fails, the sidebar item is hidden. **This is UX, not authorization.** The backend still enforces permissions on every API call. Hiding the link is a hint, not a security boundary.
## Order of operations
diff --git a/docs/developer/dashboard/customization/permissions.mdx b/docs/developer/dashboard/customization/permissions.mdx
index 6516b92df4..2bf1badc50 100644
--- a/docs/developer/dashboard/customization/permissions.mdx
+++ b/docs/developer/dashboard/customization/permissions.mdx
@@ -1,14 +1,14 @@
---
title: Permissions
sidebarTitle: Permissions
-description: How to hide UI behind CanCanCan permissions in your customisations — and why hiding is never the same as authorising.
+description: How to hide UI behind the current admin's permissions in your customisations — and why hiding is never the same as authorising.
---
<Note>
Examples here import from `@spree/dashboard`, which re-exports the framework and the design system for host applications. A **distributed plugin** imports `@spree/dashboard-core` and `@spree/dashboard-ui` directly instead — it extends the shell rather than shipping it. See [plugin overview](/developer/dashboard/plugins/overview).
</Note>
-The dashboard exposes the current admin's CanCanCan abilities to every component via the `usePermissions()` hook. The registry surfaces — nav entries, settings entries, custom routes — also accept a `subject` shortcut, and nav entries take a generic `if` predicate that reads from `permissions`.
+The dashboard exposes the current admin's permissions to every component via the `usePermissions()` hook: the catalog keys their role holds on the current store (`read_orders`, `write_products`, …) and the class-level ability rules the server compiles from those keys. The registry surfaces — nav entries, settings entries, custom routes — also accept a `subject` shortcut, and nav entries take a generic `if` predicate that reads from `permissions`.
## Two layers
@@ -17,9 +17,9 @@ UI gating is for **UX**. Backend authorization is for **security**. They are not
| Layer | Where | What it does |
|---|---|---|
| UI gating | Dashboard registries (`subject`, `if`) | Hides menu items, columns, buttons — keeps the interface tidy |
-| Authorization | Rails API controllers (CanCanCan, scopes) | Refuses the request when the user doesn't have permission |
+| Authorization | Rails API controllers (per-controller `read_*`/`write_*` key gate, record-level checks) | Refuses the request when the user doesn't have permission |
-**Always rely on the backend for security.** Hiding a button is a hint to the user, not a wall. A user with browser dev tools (or the API token) can always hit the endpoint directly — your `authorize!` call is what stops them.
+**Always rely on the backend for security.** Hiding a button is a hint to the user, not a wall. A user with browser dev tools (or the API token) can always hit the endpoint directly — the API's permission check is what stops them.
## The `permissions` object
@@ -89,7 +89,7 @@ Use it for combined checks (permission + store state), feature flags, multi-acti
## Inside components
-Use the `usePermissions()` hook — it returns `{ permissions, rules, isLoading }`:
+Use the `usePermissions()` hook — it returns `{ permissions, rules, permissionKeys, isLoading, refresh }`. `permissionKeys` is the flat key list (the same vocabulary as the role editor and API-key scopes), for when `permissionKeys.includes('read_orders')` reads better than a subject check:
```tsx
import { usePermissions } from '@spree/dashboard'
@@ -112,4 +112,4 @@ If your customization introduces a new model on the backend, register it as a pe
## Reference
- [`Permissions` interface](https://github.com/spree/spree/blob/main/packages/dashboard-core/src/providers/permission-provider.tsx)
-- [CanCanCan docs](https://github.com/CanCanCommunity/cancancan) — the Ruby ability definition language
+- [Customize Permissions](/developer/customization/permissions) — the backend permission catalog and `register_scope`
diff --git a/docs/developer/dashboard/plugins/publishing.mdx b/docs/developer/dashboard/plugins/publishing.mdx
index e386fa7116..90ba1a3f86 100644
--- a/docs/developer/dashboard/plugins/publishing.mdx
+++ b/docs/developer/dashboard/plugins/publishing.mdx
@@ -15,9 +15,9 @@ Your plugin imports React, the dashboard, Tailwind, i18next, etc., but **you don
"peerDependencies": {
"react": "^19",
"react-dom": "^19",
- "@spree/dashboard-core": "^0.10.0",
- "@spree/dashboard-ui": "^0.10.0",
- "@spree/admin-sdk": "^0.6.0",
+ "@spree/dashboard-core": "^1.0.0-beta.3",
+ "@spree/dashboard-ui": "^1.0.0-beta.3",
+ "@spree/admin-sdk": "^1.0.0-beta.2",
"i18next": "^26",
"react-i18next": "^17",
"@tanstack/react-query": "^5",
@@ -27,7 +27,7 @@ Your plugin imports React, the dashboard, Tailwind, i18next, etc., but **you don
}
```
-Use ranges, not exact versions — pin too tightly and consumers can't upgrade the dashboard without you cutting a release. One Developer Preview caveat: for `0.x` versions, `^` only allows patch-level drift (`^0.10.0` matches `0.10.x`, not `0.11.0`), so expect to bump your `@spree/dashboard-*` peers alongside dashboard releases until 1.0. `spree plugin new` scaffolds these ranges for you, matched to the current release.
+Use ranges, not exact versions — pin too tightly and consumers can't upgrade the dashboard without you cutting a release. One pre-release caveat: a range like `^1.0.0-beta.3` accepts later `1.0.0` betas and every stable `1.x` release, but not betas of other versions — so keep your `@spree/dashboard-*` peers in step with the dashboard until 1.0 ships. Check the ranges `spree plugin new` scaffolds against the versions your host app installs.
`dependencies` is for things your plugin *uses* that the host *doesn't* — small utilities (e.g., `clsx`, `date-fns` if you need a specific version, your own helper packages). When in doubt, peer-dep it. The trade-off is "user has to install one more thing" vs. "user has two copies of React" — always pay the first cost.
diff --git a/docs/developer/dashboard/plugins/scaffolding.mdx b/docs/developer/dashboard/plugins/scaffolding.mdx
index 84cb36ee68..dce0291a5f 100644
--- a/docs/developer/dashboard/plugins/scaffolding.mdx
+++ b/docs/developer/dashboard/plugins/scaffolding.mdx
@@ -15,7 +15,7 @@ your-plugin/
├── .gitignore
└── packages/
└── dashboard/
- ├── package.json # @your-scope/dashboard-your-plugin
+ ├── package.json # @your-scope/your-plugin-dashboard
├── tsconfig.json
├── biome.json
└── src/
diff --git a/docs/developer/dashboard/public-api.mdx b/docs/developer/dashboard/public-api.mdx
index 40bef5eb01..c717d0f843 100644
--- a/docs/developer/dashboard/public-api.mdx
+++ b/docs/developer/dashboard/public-api.mdx
@@ -84,7 +84,7 @@ import {
```ts
import {
useAuth, // current admin user
- usePermissions, // CanCanCan abilities
+ usePermissions, // current admin's permissions
useStore, // current store
useCommandPalette, // ⌘K palette open/close state
useGlobalSearch, // global search query state
diff --git a/docs/developer/dashboard/recipes/attribute-end-to-end.mdx b/docs/developer/dashboard/recipes/attribute-end-to-end.mdx
index 34da924779..b8a186bbfd 100644
--- a/docs/developer/dashboard/recipes/attribute-end-to-end.mdx
+++ b/docs/developer/dashboard/recipes/attribute-end-to-end.mdx
@@ -33,7 +33,7 @@ Four small pieces — each one unlocks a specific frontend capability. In a host
**The column** (with an index — you're adding it *because* it will be queried):
```ruby
-class AddLeadTimeDaysToSpreeProducts < ActiveRecord::Migration[7.2]
+class AddLeadTimeDaysToSpreeProducts < ActiveRecord::Migration[8.1]
def change
add_column :spree_products, :lead_time_days, :integer
add_index :spree_products, :lead_time_days
@@ -58,22 +58,8 @@ Spree.api.admin_product_serializer = 'Admin::ProductSerializer'
**The permitted param** — makes it *writable* (the form's Save ships it in the same PATCH as core fields). The read and write names must match:
```ruby
-# app/controllers/spree/api/v3/admin/products_controller_decorator.rb
-module Spree
- module Api
- module V3
- module Admin
- module ProductsControllerDecorator
- def permitted_params
- super.merge(params.permit(:lead_time_days))
- end
- end
-
- ProductsController.prepend(ProductsControllerDecorator)
- end
- end
- end
-end
+# config/initializers/spree.rb
+Spree::Product.additional_permitted_attributes += [:lead_time_days]
```
**The Ransack allowlist** — makes it *filterable and sortable*. Both the list's sort param and every filter predicate go through Ransack, and Ransack refuses attributes that aren't allowlisted:
@@ -209,4 +195,3 @@ Two `ColumnDef` extras worth knowing: `ransackAttribute` points the predicate so
- [Custom form field recipe](/developer/dashboard/recipes/custom-form-field) — the form layer in isolation, and the custom-field-definition path
- [Tables](/developer/dashboard/customization/tables) — the full `ColumnDef` and table registry API
- [Backend integration](/developer/dashboard/customization/backend) — serializers, permitted params, error mapping
-- [Decorators](/developer/customization/decorators) — the `prepend` pattern used for the controller
diff --git a/docs/developer/deployment/aws.mdx b/docs/developer/deployment/aws.mdx
index 8e595ab5ec..895a2d1b57 100644
--- a/docs/developer/deployment/aws.mdx
+++ b/docs/developer/deployment/aws.mdx
@@ -80,7 +80,7 @@ volumes:
docker compose up -d
```
-The database is migrated automatically on boot. Once DNS resolves, your store is live at `https://store.example.com` — admin at `/admin`, background jobs running inside the web container ([combined mode](/developer/deployment/quickstart#web-and-worker)).
+The database is migrated automatically on boot. Once DNS resolves, your store is live at `https://store.example.com` — admin dashboard at `/dashboard`, background jobs running inside the web container ([combined mode](/developer/deployment/quickstart#web-and-worker)).
## Updating
diff --git a/docs/developer/deployment/aws_ecs.mdx b/docs/developer/deployment/aws_ecs.mdx
index 312f9e4cd8..8d63b0c4f6 100644
--- a/docs/developer/deployment/aws_ecs.mdx
+++ b/docs/developer/deployment/aws_ecs.mdx
@@ -421,13 +421,13 @@ aws application-autoscaling put-scaling-policy \
### Admin
-Access your admin panel at:
+Access the admin dashboard at:
```
-https://<your-domain>/admin
+https://<your-domain>/dashboard
```
-Default credentials are created during `db:seed`. Change them immediately after first login.
+No default admin account is created. Seeding prints a one-time setup link where you create the first admin account — print it again with `bin/rails spree:setup:token`. For scripted installs, set `ADMIN_EMAIL` and `ADMIN_PASSWORD` before seeding to create the account directly.
### Database Migrations
diff --git a/docs/developer/deployment/background_jobs.mdx b/docs/developer/deployment/background_jobs.mdx
index ed8320d678..d5b975c92e 100644
--- a/docs/developer/deployment/background_jobs.mdx
+++ b/docs/developer/deployment/background_jobs.mdx
@@ -82,22 +82,28 @@ Configure the queues with weights — Sidekiq's equivalent of Solid Queue's poll
- [spree_events, 3]
- [spree_exports, 3]
- [spree_images, 3]
+ - [spree_stock_reservations, 5]
- [spree_products, 3]
- - [spree_reports, 3]
- [spree_variants, 3]
- - [spree_taxons, 3]
- - [spree_stock_location_stock_items, 3]
+ - [spree_categories, 3]
+ - [spree_collections, 3]
+ - [spree_stock_location_stock_levels, 3]
- [spree_coupon_codes, 3]
- [spree_addresses, 3]
- [spree_gift_cards, 3]
- [spree_webhooks, 3]
- [spree_api_keys, 3]
- [spree_search, 3]
+ - [spree_tax_identifiers, 3]
+ - [spree_payouts, 3]
+ - [spree_data_requests, 1]
- [active_storage_transform, 3]
- [active_storage_analysis, 1]
- [active_storage_purge, 1]
```
+Unlike Solid Queue, Sidekiq has no catch-all queue: a job on a queue missing from this list never runs. Every queue name you assign with `Spree.queues` in `config/initializers/spree.rb` must appear here. Any `Spree.queues` entry you don't assign uses `default`.
+
Move the `config/recurring.yml` schedules to sidekiq-cron (it auto-loads `config/schedule.yml`):
```yaml config/schedule.yml
diff --git a/docs/developer/deployment/docker.mdx b/docs/developer/deployment/docker.mdx
index 8b579ef344..f33e58fb67 100644
--- a/docs/developer/deployment/docker.mdx
+++ b/docs/developer/deployment/docker.mdx
@@ -119,7 +119,6 @@ docker pull ghcr.io/spree/spree:latest
| Tag | Description |
|-----|-------------|
| `latest` | Latest stable release |
-| `5.4.0` | Specific version |
-| `5.4` | Latest patch for a minor version |
+| `6.0.0` | Specific version |
Browse all tags on the [GitHub Packages page](https://github.com/spree/spree/pkgs/container/spree). The image drops into the compose file above in place of your custom tag.
diff --git a/docs/developer/deployment/emails.mdx b/docs/developer/deployment/emails.mdx
index a3eff7e039..29fdd2315f 100644
--- a/docs/developer/deployment/emails.mdx
+++ b/docs/developer/deployment/emails.mdx
@@ -28,7 +28,7 @@ Spree Backend → Webhook POST → Storefront → render email → send via Rese
#### Setup
-1. **Create a webhook endpoint** in Spree Admin → Settings → Developers → Webhooks:
+1. **Create a webhook endpoint** in Spree Admin → Settings → Developer → Webhooks:
- **URL:** `https://your-storefront.com/api/webhooks/spree`
- **Events:** `order.completed`, `order.canceled`, `order.shipped`, `customer.password_reset_requested`, `newsletter_subscriber.subscription_requested`
@@ -55,6 +55,10 @@ Spree Backend → Webhook POST → Storefront → render email → send via Rese
| `customer.password_reset_requested` | Password reset link |
| `newsletter_subscriber.subscription_requested` | Newsletter double opt-in confirmation link |
+<Note>
+ The storefront listens for `order.completed` and `order.shipped`, the names these events had before Spree 6.0. Spree 6.0 still sends them alongside the new names, `order.placed` and `order.fulfilled`, but stops in Spree 6.1. Before upgrading to 6.1, switch the storefront handlers and your webhook endpoint subscriptions to the new names.
+</Note>
+
#### Custom Frameworks
If you're not using the Next.js storefront, you can build your own webhook handler with any framework. Use `@spree/sdk/webhooks` for signature verification:
diff --git a/docs/developer/deployment/environment_variables.mdx b/docs/developer/deployment/environment_variables.mdx
index c7b78d4b74..1dbda39f85 100644
--- a/docs/developer/deployment/environment_variables.mdx
+++ b/docs/developer/deployment/environment_variables.mdx
@@ -107,11 +107,11 @@ Optional. When configured, Spree uses [Meilisearch](/integrations/search/meilise
| `MEILISEARCH_URL` | `http://localhost:7700` | Meilisearch server URL |
| `MEILISEARCH_API_KEY` | — | Meilisearch master key. Not needed for local development — only required when Meilisearch is started with `MEILI_MASTER_KEY`. |
-After setting these, enable the provider and reindex:
+After setting these, add the `spree_meilisearch` gem, enable the provider and reindex:
```ruby
# config/initializers/spree.rb
-Spree.search_provider = 'Spree::SearchProvider::Meilisearch'
+Spree.search_provider = 'SpreeMeilisearch::SearchProvider'
```
<CodeGroup>
diff --git a/docs/developer/deployment/render.mdx b/docs/developer/deployment/render.mdx
index 31143a7f79..a29dbf334f 100644
--- a/docs/developer/deployment/render.mdx
+++ b/docs/developer/deployment/render.mdx
@@ -29,11 +29,11 @@ The database is seeded on first boot. Your store is ready in a few minutes — i
### Admin
```
-https://<your-app-name>.onrender.com/admin # admin panel
+https://<your-app-name>.onrender.com/dashboard # admin dashboard
https://<your-app-name>.onrender.com/jobs # background jobs dashboard
```
-Default credentials are created during seeding. Change them immediately after first login.
+No default admin account is created. Seeding prints a one-time setup link where you create the first admin account — print it again from the web service's **Shell** tab with `bin/rails spree:setup:token`.
The `/jobs` dashboard uses HTTP Basic auth: user `jobs`, with a password the Blueprint generates — read it in the Render dashboard under the web service's **Environment** tab (`MISSION_CONTROL_PASSWORD`).
diff --git a/docs/developer/how-to/build-a-marketplace.mdx b/docs/developer/how-to/build-a-marketplace.mdx
index 5f579c57db..12ac49e321 100644
--- a/docs/developer/how-to/build-a-marketplace.mdx
+++ b/docs/developer/how-to/build-a-marketplace.mdx
@@ -31,7 +31,7 @@ To try the flow quickly, you can seed a sample seller with an owner account, a p
<CodeGroup>
```bash Spree CLI
-spree run rake spree:sellers:sample_data
+spree rake spree:sellers:sample_data
```
```bash Without CLI
@@ -757,7 +757,7 @@ const tokens = await sellerClient.auth.login({
password: '…',
})
-sellerClient.setToken(tokens.access_token)
+sellerClient.setToken(tokens.token)
// A user who runs several sellers picks which one they are acting as
sellerClient.setSeller('sel_xxx')
diff --git a/docs/developer/how-to/custom-api-authentication.mdx b/docs/developer/how-to/custom-api-authentication.mdx
index 06c45d4216..8ff77df667 100644
--- a/docs/developer/how-to/custom-api-authentication.mdx
+++ b/docs/developer/how-to/custom-api-authentication.mdx
@@ -59,7 +59,7 @@ Client → POST /api/v3/store/auth/login
Client → subsequent calls with `Authorization: Bearer <Spree JWT>`
```
-The third-party JWT proves identity **once, at login**. After that, the client uses the Spree JWT for everything, and `/auth/refresh` rotates it via Spree's own refresh-token mechanism. Your existing CanCanCan rules, `current_user`, and serializer params just work.
+The third-party JWT proves identity **once, at login**. After that, the client uses the Spree JWT for everything, and `/auth/refresh` rotates it via Spree's own refresh-token mechanism. Your existing authorization, `current_user`, and serializer params just work.
## Step 1: Create the Strategy Class
diff --git a/docs/developer/how-to/custom-delivery-rate-provider.mdx b/docs/developer/how-to/custom-delivery-rate-provider.mdx
index 68054a8570..0f3adaba5f 100644
--- a/docs/developer/how-to/custom-delivery-rate-provider.mdx
+++ b/docs/developer/how-to/custom-delivery-rate-provider.mdx
@@ -64,6 +64,10 @@ module SpreeAcmeCarrier
class DeliveryRateProvider < Spree::DeliveryRateProvider::Base
def self.integration_class = 'SpreeAcmeCarrier::Integration'
+ # A carrier quotes real parcels to an address, so it can only price
+ # delivery methods that ship (not pickup or digital).
+ def self.requires_address? = true
+
def estimates(package)
quotes_for(package).map do |quote|
Spree::DeliveryRateProvider::Estimate.new(
@@ -148,10 +152,14 @@ end
```ruby
# config/initializers/spree.rb
-Spree.delivery_rate_providers << 'SpreeAcmeCarrier::DeliveryRateProvider'.constantize
-Spree.integrations << 'SpreeAcmeCarrier::Integration'
+Rails.application.config.after_initialize do
+ Spree.delivery_rate_providers << SpreeAcmeCarrier::DeliveryRateProvider
+ Spree.integrations << 'SpreeAcmeCarrier::Integration'
+end
```
+Register inside `after_initialize`: Spree sets up its own integrations list after your initializers run, so an entry added at the top level of the file would be dropped.
+
Registration is what makes a provider selectable: Spree validates `rate_provider` against this list, so a typo fails when the method is saved rather than deep inside checkout.
## 4. Use it
@@ -190,7 +198,7 @@ class SpreeAcmeCarrier::Integration < Spree::Integration
{
tracking_code: payload['tracking_code'],
- tracking_status: STATUS_MAP.fetch(payload['status'], 'unknown'), # Spree::Fulfillment::TRACKING_STATUSES
+ tracking_status: STATUS_MAP.fetch(payload['status'], 'unknown'), # one of Spree::Delivery::STATUSES
estimated_delivery_at: payload['eta'],
delivered_at: payload['delivered_scan_at'],
details: payload.slice('status_detail', 'carrier')
diff --git a/docs/developer/how-to/custom-document-numbers.mdx b/docs/developer/how-to/custom-document-numbers.mdx
index 2544d10239..870bd41c3f 100644
--- a/docs/developer/how-to/custom-document-numbers.mdx
+++ b/docs/developer/how-to/custom-document-numbers.mdx
@@ -7,7 +7,7 @@ description: Change the shape of order, return and other document numbers — fr
Every order, return, exchange, claim, stock transfer, import and export carries a **document number** — the short, human-readable reference a merchant reads out on a support call and a customer quotes in an email. Orders look like `R1001`, returns like `RET1001`.
-Numbers are separate from IDs. Every record also has a prefixed ID (`order_86Rf07xd4z`) which is what the API uses and what you should reference in code. The number exists purely so people can read, say and type it.
+Numbers are separate from IDs. Every record also has a prefixed ID (`or_86Rf07xd4z`) which is what the API uses and what you should reference in code. The number exists purely so people can read, say and type it.
There are two ways to change it. Merchants can reshape **order numbers** from the dashboard without any code. Developers can replace the generator for **any** document type when the settings are not enough.
diff --git a/docs/developer/how-to/custom-order-routing.mdx b/docs/developer/how-to/custom-order-routing.mdx
index 9dd54421c6..de75fc969c 100644
--- a/docs/developer/how-to/custom-order-routing.mdx
+++ b/docs/developer/how-to/custom-order-routing.mdx
@@ -9,14 +9,14 @@ import { Since } from '/snippets/since.mdx';
## Overview
-Order routing decides which [Stock Location](/developer/core-concepts/inventory#stock-locations) fulfills an order at checkout. Spree gives you two extension points:
+Order routing decides which [Stock Location](/developer/core-concepts/inventory#stock-locations) fulfills an order when Spree builds the order's fulfillments (`Order#rebuild_fulfillments!`) — orders created or edited by staff through the Admin API or dashboard, and items added to an order after it was placed. Storefront checkout does not go through it: a cart builds its fulfillments with `Spree::Stock::Coordinator`, and completing checkout copies them onto the order. Spree gives you two extension points:
- **Rules** — add a new signal to the existing rules-walking algorithm (proximity, customer tier, refrigerated SKUs, day-of-week dispatch).
- **Strategies** — replace the algorithm entirely (delegate to a warehouse management system, run an ML model, call an optimization solver).
This guide covers both. Most extensions are rules — they compose with the built-ins and don't require rewriting the pipeline.
-Before starting, make sure you understand [how order routing works in Spree](/developer/core-concepts/fulfillments#order-routing).
+Before starting, make sure you understand how [fulfillments](/developer/core-concepts/fulfillments) and [stock locations](/developer/core-concepts/inventory) work in Spree.
| If the answer is "yes" | Pick |
|---|---|
@@ -160,8 +160,8 @@ The contract is `Spree::OrderRouting::Strategy::Base`. There are no defaults —
| Method | When it fires | Returns |
|---|---|---|
-| `#for_allocation` | Cart → checkout transition (`Order#create_proposed_shipments`) | `Array<Spree::Stock::Package>` |
-| `#for_sale(fulfillment:)` | A shipment ships | (side effect) |
+| `#for_allocation` | The order's fulfillments are built (`Order#rebuild_fulfillments!`) | `Array<Spree::Stock::Package>` |
+| `#for_sale(fulfillment:)` | A fulfillment ships | (side effect) |
| `#for_release` | An in-flight order is canceled before shipping | (side effect) |
| `#for_cancellation` | A shipped order is canceled (return) | (side effect) |
@@ -206,10 +206,11 @@ module Acme
def build_package(assignment)
location = Spree::StockLocation.find_by!(code: assignment.location_code)
- units = order.inventory_units.where(variant_id: assignment.variant_ids).to_a
+ units = Spree::Stock::InventoryUnitBuilder.new(order).units
+ .select { |unit| assignment.variant_ids.include?(unit.variant_id) }
- package = Spree::Stock::Packer.new(location, units, Spree.stock_splitters).packages.first
- package.shipping_rates = Spree::Stock::Estimator.new(order).shipping_rates(package)
+ package = Spree::Stock::Packer.new(location, units, Spree.stock_splitters, owner: order).packages.first
+ package.delivery_rates = Spree::Stock::Estimator.new(order).delivery_rates(package)
package
end
@@ -224,8 +225,8 @@ end
Notes:
- **Strategies are plain Ruby classes**, not ActiveRecord models. Live under `app/models/` so the autoloader picks them up; or anywhere on the load path if you'd rather organize them as services.
-- **`for_allocation` returns `Spree::Stock::Package` objects.** The order's `create_proposed_shipments` turns those into `Shipment`s by calling `package.to_shipment`. Returning shipments directly will break the call site.
-- **Reuse the existing primitives.** `Spree::Stock::Packer`, `Spree::Stock::Estimator`, and `Spree::Stock::InventoryUnitBuilder` handle packing, rate estimation, and inventory unit construction. Custom strategies are about the location decision, not re-implementing the packing pipeline.
+- **`for_allocation` returns `Spree::Stock::Package` objects.** The order's `rebuild_fulfillments!` turns those into `Spree::Fulfillment`s by calling `package.to_fulfillment`. Returning fulfillments directly will break the call site.
+- **Reuse the existing primitives.** `Spree::Stock::Packer`, `Spree::Stock::Estimator`, and `Spree::Stock::InventoryUnitBuilder` handle packing, delivery rate estimation, and building the units to pack. Custom strategies are about the location decision, not re-implementing the packing pipeline.
### Step 2: Register the Strategy
@@ -259,7 +260,7 @@ Resolution order: `channel.preferred_order_routing_strategy` → `store.preferre
### Step 3: Test the Strategy
-Strategy tests are integration tests — build an order, instantiate the strategy, exercise the four methods, assert on the resulting shipments and mocked side effects.
+Strategy tests are integration tests — build an order, instantiate the strategy, exercise the four methods, assert on the resulting packages and mocked side effects.
```ruby spec/models/acme/oms/strategy_spec.rb
require 'rails_helper'
@@ -294,15 +295,15 @@ end
- **Forgetting the lifecycle hooks.** `for_release` and `for_cancellation` raise `NotImplementedError` by default. If your algorithm doesn't need post-allocation hooks, override them as no-ops explicitly.
- **Ignoring inventory.** Even custom strategies should query `Spree::StockLocation.active` and respect the order's reserved units. Hardcoding `Spree::StockLocation.first` will work in tests and break in production.
-- **Side effects in `for_sale` / `for_release`.** These fire from state-machine callbacks where the order may already be partially mutated. Treat the methods as side-effect endpoints; pull what you need from the `order` and `fulfillment` arguments — don't reload state mid-call.
+- **Side effects in `for_sale` / `for_release`.** These fire while the order or fulfillment is changing status, so the order may already be partially mutated. Treat the methods as side-effect endpoints; pull what you need from the `order` and `fulfillment` arguments — don't reload state mid-call.
## Coexistence with Stock Reservations
-Stock reservations and order routing are independent systems in 5.5 — they make decisions at different times and protect different invariants.
+Stock reservations and order routing are independent systems — they make decisions at different times and protect different invariants.
| Concern | Reservation system | Order routing |
|---|---|---|
-| **When it fires** | Cart mutation (add item, change qty, enter checkout) | Cart → checkout transition |
+| **When it fires** | Cart changes during checkout (add item, change quantity); released when the order is placed | When an order's fulfillments are built (`Order#rebuild_fulfillments!`) |
| **What it decides** | How many units of a variant are held for this cart | Which `StockLocation` fulfills the order |
| **Granularity** | Per-variant | Per-order |
@@ -311,7 +312,7 @@ Stock reservations and order routing are independent systems in 5.5 — they mak
What this means for you when writing custom rules and strategies:
- **Don't read `StockReservation` from inside a routing rule's `#rank`.** The reservations were created against arbitrary stock_items at cart time and don't reflect the routing decision.
-- **Don't relocate reservations from a custom strategy's `for_allocation`.** That's the path 6.0 codifies; doing it ad-hoc in 5.5 races against the cart services that own reservation lifecycle.
+- **Don't relocate reservations from a custom strategy's `for_allocation`.** Reservations belong to the cart workflows that create and release them; moving them from a strategy races against those workflows.
- **`AvailabilityValidator` is the safety net.** If a routing decision picks a location that's actually short on stock, the validator catches it before the order completes.
## Next Steps
diff --git a/docs/developer/how-to/custom-payment-method.mdx b/docs/developer/how-to/custom-payment-method.mdx
index 325230af12..19fc8e2375 100644
--- a/docs/developer/how-to/custom-payment-method.mdx
+++ b/docs/developer/how-to/custom-payment-method.mdx
@@ -98,11 +98,12 @@ class MyGateway < Spree::PaymentMethod
provider_session = MyProvider::Client.new(preferred_api_key).create_session(
amount: (total * 100).to_i, # amount in cents
currency: order.currency,
- metadata: { order_number: order.number }
+ metadata: { cart_id: order.prefixed_id }
)
+ # `order:` receives the cart during checkout — assign it as the owner
payment_sessions.create!(
- order: order,
+ owner: order,
amount: total,
currency: order.currency,
external_id: provider_session.id,
@@ -130,8 +131,7 @@ class MyGateway < Spree::PaymentMethod
#
# Responsibilities:
# - Verify payment status with the provider
- # - Create the Spree::Payment record
- # - Transition the payment to the correct state
+ # - Create the Spree::Payment record and move it to the right status
# - Mark the session as completed/failed
#
# Must NOT complete the order — that is handled by Carts::Complete
@@ -143,21 +143,19 @@ class MyGateway < Spree::PaymentMethod
)
if result.status == 'succeeded'
- payment_session.process!
+ payment_session.process if payment_session.can_process?
- # Create the Spree::Payment record
- payment = payment_session.find_or_create_payment!
+ # Create the Spree::Payment record (or find the one a webhook already
+ # created) and mark it completed — captured: false leaves it pending
+ # for an authorization-only payment
+ payment_session.settle_payment!(captured: true)
- # Transition the payment to completed
- if payment.present? && !payment.completed?
- payment.started_processing! if payment.checkout?
- payment.complete! if payment.can_complete?
- end
-
- payment_session.complete!
+ payment_session.complete unless payment_session.completed?
else
- payment_session.fail!
+ payment_session.fail if payment_session.can_fail?
end
+
+ payment_session
end
def payment_icon_name
@@ -171,8 +169,8 @@ end
The frontend creates a session, then uses the provider's SDK to collect payment:
```typescript
-// 1. Get available payment methods
-const methods = await client.carts.paymentMethods.list(cart.id, options)
+// 1. Get available payment methods (embedded in the cart)
+const methods = cart.payment_methods
// 2. Find your gateway (check session_required flag)
const myGateway = methods.find(m => m.session_required)
@@ -329,9 +327,9 @@ class MyGateway < Spree::PaymentMethod
setup_session.update!(
payment_source: credit_card
)
- setup_session.complete!
+ setup_session.complete
else
- setup_session.fail!
+ setup_session.fail
end
setup_session
diff --git a/docs/developer/how-to/custom-promotion.mdx b/docs/developer/how-to/custom-promotion.mdx
index 5ddd1402d8..b559f421ad 100644
--- a/docs/developer/how-to/custom-promotion.mdx
+++ b/docs/developer/how-to/custom-promotion.mdx
@@ -62,7 +62,7 @@ end
The `options` hash passed to `eligible?` can include `:user`, `:email`, and other context from the checkout flow.
<Warning>
-Accept **both** `Spree::Cart` and `Spree::Order` in `applicable?`. Promotions are evaluated on every cart change, long before the cart becomes an order, and a cart is its own model rather than an unfinished order. A rule guarding on `Spree::Order` alone silently never applies during checkout — the promotion just appears not to work. Every built-in rule accepts both.
+Accept **both** `Spree::Cart` and `Spree::Order` in `applicable?`. Promotions are evaluated on every cart change, long before the cart becomes an order, and a cart is its own model rather than an unfinished order. A rule that isn't applicable is skipped rather than failed, so a rule guarding on `Spree::Order` alone is silently ignored during checkout — its condition is never checked and the promotion applies as if the rule weren't there. Every built-in rule accepts both.
</Warning>
#### Using Preferences
@@ -264,7 +264,7 @@ Like rules, registered actions surface automatically in the dashboard's promotio
## Custom Adjusters
-Not every charge or reduction is a promotion. A gift wrap fee, a payment surcharge, or loyalty pricing has no rules, no coupon codes, and no competition — it just needs to be on the order whenever it applies. That's an **adjuster**: a class invoked on every recalculation that owns a family of [Fee](/developer/core-concepts/fees) or [Discount](/developer/core-concepts/discounts) rows.
+Not every charge or reduction is a promotion. A gift wrap fee or a payment surcharge has no rules, no coupon codes, and no competition — it just needs to be on the order whenever it applies. That's an **adjuster**: a class invoked on every recalculation that owns a family of [Fee](/developer/core-concepts/fees) rows.
```ruby server/app/models/my_app/adjusters/gift_wrap.rb
module MyApp
@@ -290,11 +290,11 @@ Rails.application.config.after_initialize do
end
```
-The contract is one method: `update`. It runs on every recalculation, so it must be idempotent — write the rows that should exist, remove the ones that shouldn't (that's why the example uses `find_or_initialize_by` keyed by `kind` rather than `create`). The `order` it receives is the cart during checkout and the order after placement, and rows attach to it either way.
+The contract is one method: `update`. It runs on every recalculation, so it must be idempotent — write the rows that should exist, remove the ones that shouldn't (that's why the example uses `find_or_initialize_by` keyed by `kind` rather than `create`). The `order` it receives is the cart during checkout. Adjusters don't run once an order is placed — a placed order's discount, fee and tax rows are frozen and only re-summed, so post-placement changes go through the admin discount and fee endpoints.
There's no totals bookkeeping to do: after all adjusters run, Spree re-sums the typed rows into the order totals and the tax provider estimates tax on the result — a fee you write here gets taxed in the same pass, like any other fee.
-Custom discounts work the same way, writing `order.discounts` rows with your own `kind` (e.g. `'loyalty'`). Use a kind other than `'promotion'` — promotion rows belong to the promotion engine, which removes any it didn't write itself.
+Discount rows are limited to two kinds, `promotion` and `manual`, and promotion rows belong to the promotion engine, which removes any it didn't write itself. Reductions that need rules, codes or stacking are best modeled as a [custom promotion action](#custom-promotion-actions); note that the order's `discount_total` counts promotion discounts only.
## Testing
diff --git a/docs/developer/how-to/custom-search-provider.mdx b/docs/developer/how-to/custom-search-provider.mdx
index 2d15beee7a..dc700a4223 100644
--- a/docs/developer/how-to/custom-search-provider.mdx
+++ b/docs/developer/how-to/custom-search-provider.mdx
@@ -15,7 +15,7 @@ This guide walks you through building a custom search provider for Spree. By the
Before starting, make sure you understand [how search and filtering works in Spree](/developer/core-concepts/search-filtering).
<Info>
-Spree ships with a built-in [Meilisearch provider](/integrations/search/meilisearch). If Meilisearch fits your needs, you don't need to build a custom provider — just configure it.
+Spree offers an official [Meilisearch provider](/integrations/search/meilisearch) in the `spree_meilisearch` gem. If Meilisearch fits your needs, you don't need to build a custom provider — just install and configure it.
</Info>
## Architecture
@@ -24,7 +24,7 @@ Spree ships with a built-in [Meilisearch provider](/integrations/search/meilisea
Store API Request (locale=de, currency=EUR)
│
├─ AR Scope (security + visibility)
- │ store.products.active(currency).accessible_by(ability)
+ │ store.products.available(now, currency), narrowed to the channel/catalogs
│
└─ Search Provider (search + filter + facets)
├─ Database (default): ILIKE + Ransack + FiltersAggregator
@@ -113,7 +113,7 @@ Products are indexed as **one document per market × locale** combination. The `
```ruby app/models/my_app/search_provider/typesense.rb
def index(product)
- documents = Spree::SearchProvider::ProductPresenter.new(product, store).call
+ documents = presenter_class.new(product, store).call
documents.each do |doc|
client.collections[index_name].documents.upsert(doc)
end
@@ -129,8 +129,17 @@ def remove_by_id(prefixed_id)
filter_by: "product_id:=#{prefixed_id}"
)
end
+
+# The registered presenter — SpreeMeilisearch::ProductPresenter when the gem is installed
+def presenter_class
+ Spree::Dependencies.search_product_presenter_class
+end
```
+<Note>
+`SpreeMeilisearch::ProductPresenter` ships with the `spree_meilisearch` gem — add the gem to reuse its document shape. Otherwise, write your own presenter and register it with `Spree::Dependencies.search_product_presenter`.
+</Note>
+
The `ProductPresenter` returns an array of documents. For a store with US (USD/English) and EU (EUR/German+French) markets, one product produces 3 documents — each with flat `name`, `price`, `locale`, `currency` fields.
## Step 4: Implement Bulk Reindex
@@ -204,7 +213,7 @@ Spree::SearchProvider::SearchResult.new(
### ProductPresenter
```ruby
-documents = Spree::SearchProvider::ProductPresenter.new(product, store).call
+documents = SpreeMeilisearch::ProductPresenter.new(product, store).call
# => [
# { prefixed_id: "prod_abc_en_USD", product_id: "prod_abc", locale: "en",
# currency: "USD", name: "Blue Shirt", price: 29.99, ... },
@@ -239,4 +248,4 @@ Document shaping for `cf_*` fields stays on `search_product_presenter` — the o
## Related Documentation
- [Search & Filtering](/developer/core-concepts/search-filtering) — Store API search reference
-- [Meilisearch Integration](/integrations/search/meilisearch) — Built-in Meilisearch provider setup
+- [Meilisearch Integration](/integrations/search/meilisearch) — Meilisearch provider setup
diff --git a/docs/developer/how-to/custom-stock-splitter.mdx b/docs/developer/how-to/custom-stock-splitter.mdx
index 9af2ad469a..95dce73a61 100644
--- a/docs/developer/how-to/custom-stock-splitter.mdx
+++ b/docs/developer/how-to/custom-stock-splitter.mdx
@@ -1,15 +1,15 @@
---
title: Build a Custom Stock Splitter
-description: Step-by-step guide to extending Spree's stock splitter chain — break a location's allocation into multiple shipments along your own axis (refrigeration, gift wrap, bin size, hazmat, anything you need to physically separate).
+description: Step-by-step guide to extending Spree's stock splitter chain — break a location's allocation into multiple fulfillments along your own axis (refrigeration, gift wrap, bin size, hazmat, anything you need to physically separate).
---
## Overview
-When [Order Routing](/developer/core-concepts/fulfillments#order-routing) picks one or more stock locations to fulfill an order, each location's allocation is then run through a chain of **splitters**. Each splitter looks at the packages produced so far and decides whether to break them further along its own axis.
+When [Order Routing](/developer/how-to/custom-order-routing) picks one or more stock locations to fulfill an order, each location's allocation is then run through a chain of **splitters**. Each splitter looks at the packages produced so far and decides whether to break them further along its own axis.
-Spree ships with four splitters out of the box (`ShippingCategory`, `Backordered`, `Digital`, `Weight`). You add your own when you need a *physical* separation that isn't expressed by any of the existing ones — refrigerated SKUs that can't share a box with ambient ones, hazmat goods that need their own carrier label, gift-wrap items that ship from a separate processing room, and so on.
+Spree ships with three splitters out of the box: `DeliveryProfile` (keeps each package to a single [delivery profile](/developer/core-concepts/delivery-setup#delivery-profiles)), `Backordered` and `Weight`. The default chain is `DeliveryProfile` then `Backordered`; `Weight` is opt-in. You add your own when you need a *physical* separation that isn't expressed by any of the existing ones — refrigerated SKUs that can't share a box with ambient ones, hazmat goods that need their own carrier label, gift-wrap items that ship from a separate processing room, and so on.
-Before starting, make sure you understand [how splitting works in Spree](/developer/core-concepts/fulfillments#stock-splitters) and the [order routing](/developer/core-concepts/fulfillments#order-routing) layer that runs before splitters.
+Before starting, make sure you understand [how delivery profiles split a cart](/developer/core-concepts/delivery-setup#delivery-profiles) and the [order routing](/developer/how-to/custom-order-routing) layer that runs before splitters.
| If the answer is "yes" | Pick |
|---|---|
@@ -74,12 +74,12 @@ end
#### What `package.contents` Looks Like
-Each `package.contents` is an array of `Spree::Stock::ContentItem` — wrappers around `InventoryUnit`. The two attributes you'll use most:
+Each `package.contents` is an array of `Spree::Stock::ContentItem` — wrappers around a `Spree::FulfillmentItem`. The attributes you'll use most:
```ruby
content.variant # The Spree::Variant being shipped
-content.inventory_unit # The Spree::InventoryUnit (gives access to line_item, order, etc.)
-content.weight # Convenience: variant.weight × inventory_unit.quantity
+content.inventory_unit # The Spree::FulfillmentItem (gives access to line_item, quantity, etc.)
+content.weight # Convenience: variant.weight × quantity
content.state # :on_hand or :backordered
```
@@ -90,43 +90,44 @@ So the splitter's job is "look at each package's contents, decide which contents
Splitters are registered globally on `Rails.application.config.spree.stock_splitters` — every order runs through the full chain. Add yours in `config/initializers/spree.rb`:
```ruby config/initializers/spree.rb
-Rails.application.config.to_prepare do
+Rails.application.config.after_initialize do
Rails.application.config.spree.stock_splitters << Spree::Stock::Splitter::Refrigerated
end
```
-The `to_prepare` block re-runs on Zeitwerk code reloads in development, so the splitter survives reloads correctly. Putting the line at the top of the initializer (outside `to_prepare`) works too in production but can leave a stale registry in development.
+Spree assigns its default chain in its own `after_initialize`, which runs after your initializer files — so a splitter appended at the top level of the file, or in a `to_prepare` block, is overwritten at boot. Registering in `after_initialize` runs after Spree's defaults. The chain holds the class loaded at boot, so restart the server in development after changing the splitter.
#### Replacing the Whole Chain
If you'd rather control the full chain (uncommon — the defaults are well-chosen), assign instead of append:
```ruby
-Rails.application.config.spree.stock_splitters = [
- Spree::Stock::Splitter::ShippingCategory,
- Spree::Stock::Splitter::Refrigerated, # custom one slotted in
- Spree::Stock::Splitter::Backordered,
- Spree::Stock::Splitter::Digital
-]
+Rails.application.config.after_initialize do
+ Rails.application.config.spree.stock_splitters = [
+ Spree::Stock::Splitter::DeliveryProfile,
+ Spree::Stock::Splitter::Refrigerated, # custom one slotted in
+ Spree::Stock::Splitter::Backordered
+ ]
+end
```
#### Ordering Matters
Splitters run in array order, each feeding the next. Two practical rules:
-1. **Coarse before fine.** `ShippingCategory` runs first by default because it groups packages by carrier-relevant category before any other axis cuts in. Your custom splitter usually wants to run after it, unless you're separating items that should *never* share a package even within a category (e.g. hazmat).
+1. **Coarse before fine.** `DeliveryProfile` runs first by default because it groups packages by delivery profile — which decides the delivery methods a package can use — before any other axis cuts in. Your custom splitter usually wants to run after it, unless you're separating items that should *never* share a package even within a profile (e.g. hazmat).
2. **`Backordered` should usually be last among the "type" splitters.** It splits on-hand from backordered items, which is a state-axis split rather than a packaging-axis split. Splitting before `Backordered` gives you finer category buckets; splitting after does too — pick based on whether your axis applies to backorders. Refrigerated items have the same handling whether on-hand or backordered, so running before `Backordered` is fine. Hazmat shipping rules might differ between on-hand (real package) and backorder (paperwork only), so running after might be cleaner.
### Step 3: Test the Splitter
-Splitter tests are unit tests — instantiate a fake `Packer`, hand the splitter a hand-built package, assert on the output. There's no factory required.
+Splitter tests are unit tests — instantiate a `Packer`, hand the splitter a hand-built package, assert on the output. There's no factory required.
```ruby spec/models/spree/stock/splitter/refrigerated_spec.rb
require 'rails_helper'
RSpec.describe Spree::Stock::Splitter::Refrigerated, type: :model do
let(:stock_location) { build_stubbed(:stock_location) }
- let(:packer) { instance_double(Spree::Stock::Packer, stock_location: stock_location) }
+ let(:packer) { Spree::Stock::Packer.new(stock_location, []) }
let(:cold_variant) { build_stubbed(:variant).tap { |v| allow(v).to receive(:refrigerated?).and_return(true) } }
let(:warm_variant) { build_stubbed(:variant).tap { |v| allow(v).to receive(:refrigerated?).and_return(false) } }
@@ -162,8 +163,8 @@ RSpec.describe Spree::Stock::Splitter::Refrigerated, type: :model do
end
def content_item_for(variant)
- inventory_unit = build_stubbed(:inventory_unit, variant: variant)
- Spree::Stock::ContentItem.new(inventory_unit, :on_hand)
+ fulfillment_item = build_stubbed(:fulfillment_item, variant: variant)
+ Spree::Stock::ContentItem.new(fulfillment_item, :on_hand)
end
end
```
@@ -197,8 +198,8 @@ Splitters and routing run in series, not in parallel — every package a splitte
|---|---|---|
| 1 | Routing | `Strategy::Rules#for_allocation` ranks all eligible locations |
| 2 | Per-location packing | One `Packer` per location runs the full splitter chain |
-| 3 | Cross-location dedup | `Prioritizer.Adjuster` walks packages in rank order, assigns each inventory unit to the first package with on-hand stock |
-| 4 | Rate estimation | `Estimator` attaches shipping rates |
+| 3 | Cross-location dedup | `Prioritizer.Adjuster` walks packages in rank order, assigns each unit to the first package with on-hand stock |
+| 4 | Rate estimation | `Estimator` attaches delivery rates |
Practical implications:
@@ -208,6 +209,6 @@ Practical implications:
## Next Steps
-- [Shipments — Stock Splitters](/developer/core-concepts/fulfillments#stock-splitters) — Concept overview and built-in splitter list
-- [Build Custom Order Routing](/developer/how-to/custom-order-routing) — The other layer of split-shipment customization
+- [Delivery Setup — Delivery profiles](/developer/core-concepts/delivery-setup#delivery-profiles) — Why every package keeps to a single delivery profile
+- [Build Custom Order Routing](/developer/how-to/custom-order-routing) — The other layer of split-fulfillment customization
- [Custom Fields](/developer/core-concepts/metafields) — Tag variants with the data your splitter reads
diff --git a/docs/developer/how-to/sell-digital-products.mdx b/docs/developer/how-to/sell-digital-products.mdx
index 4d93520c12..bf4a16df3f 100644
--- a/docs/developer/how-to/sell-digital-products.mdx
+++ b/docs/developer/how-to/sell-digital-products.mdx
@@ -34,7 +34,7 @@ await adminClient.products.update('prod_86Rf07xd4z', {
curl -X PATCH 'https://api.mystore.com/api/v3/admin/products/prod_86Rf07xd4z' \
-H 'X-Spree-API-Key: sk_xxx' \
-H 'Content-Type: application/json' \
- -d '{ "delivery_profile_id": "dp_digital" }'
+ -d '{ "delivery_profile_id": "fp_digital" }'
```
</CodeGroup>
diff --git a/docs/developer/multi-tenant/quickstart.mdx b/docs/developer/multi-tenant/quickstart.mdx
index 0bfcb800d2..28c24e47e5 100644
--- a/docs/developer/multi-tenant/quickstart.mdx
+++ b/docs/developer/multi-tenant/quickstart.mdx
@@ -29,7 +29,7 @@ All data is fully isolated besides the staff users, which can manage multiple te
## Prerequisites
* You need to be on Spree 5.1+, we recommend using [CLI](/developer/getting-started) to setup your Spree application.
-* You need to set 2 environment variables in your `backend` directory:
+* You need to set 2 environment variables in your `server` directory:
* `KEYGEN_ACCOUNT_ID`
* `KEYGEN_LICENSE_KEY`
* Both PostgreSQL and MySQL are supported
@@ -92,7 +92,7 @@ spree eject
```yaml docker-compose.yml
x-app: &app
build:
- context: ./backend
+ context: ./server
dockerfile: Dockerfile
target: dev
secrets: # [!code ++]
diff --git a/docs/developer/providers/payouts.mdx b/docs/developer/providers/payouts.mdx
index 33a5445c28..4dcf74d6c3 100644
--- a/docs/developer/providers/payouts.mdx
+++ b/docs/developer/providers/payouts.mdx
@@ -130,10 +130,14 @@ end
### Register it
```ruby server/config/initializers/spree.rb
-Spree.integrations << 'MyApp::AcmeIntegration'
-Spree.payout_providers << MyApp::PayoutProvider
+Rails.application.config.after_initialize do
+ Spree.integrations << 'MyApp::AcmeIntegration'
+ Spree.payout_providers << MyApp::PayoutProvider
+end
```
+Register inside `after_initialize`: Spree sets up its own integrations list after your initializers run, so an entry added at the top level of the file would be dropped.
+
The operator then picks it under **Settings → Marketplace**, which is the store's `payout_provider` preference. The picker is built from the registry, so your provider appears alongside the built-in one and reports whether the store can use it today:
<CodeGroup>
diff --git a/docs/developer/sdk/admin/querying-and-errors.mdx b/docs/developer/sdk/admin/querying-and-errors.mdx
index b0eae0683a..5be1a033ef 100644
--- a/docs/developer/sdk/admin/querying-and-errors.mdx
+++ b/docs/developer/sdk/admin/querying-and-errors.mdx
@@ -10,7 +10,7 @@ Collection endpoints support [Ransack](https://activerecord-hackery.github.io/ra
```typescript
const { data: orders } = await client.orders.list({
- status_eq: 'complete', // exact match
+ status_eq: 'placed', // exact match
total_gteq: 100, // greater than or equal
email_cont: '@example.com', // substring match
customer_id_eq: 'cus_xxx', // prefixed IDs work directly
diff --git a/docs/developer/sdk/admin/quickstart.mdx b/docs/developer/sdk/admin/quickstart.mdx
index 66e00e0121..82bad7e253 100644
--- a/docs/developer/sdk/admin/quickstart.mdx
+++ b/docs/developer/sdk/admin/quickstart.mdx
@@ -6,14 +6,14 @@ description: "Install and configure @spree/admin-sdk, the official TypeScript cl
[`@spree/admin-sdk`](https://www.npmjs.com/package/@spree/admin-sdk) is the official TypeScript SDK for the [Admin API v3](/api-reference/admin-api/introduction) — the back-office counterpart to [`@spree/sdk`](/developer/sdk/quickstart). Use it to build integrations, automations, internal tools, and custom admin UIs: manage products, orders, customers, stock, promotions, webhooks, and more.
-<Warning>
- The Admin SDK is in **Developer Preview** on the `0.x` line and published under the `next` dist-tag. The API surface may change between minor versions — check the [changelog](https://github.com/spree/spree/blob/main/packages/admin-sdk/CHANGELOG.md) when updating. It requires Spree 5.5 or newer.
-</Warning>
+<Note>
+ `@spree/admin-sdk` 1.x works with the Spree 6.0 Admin API. Check the [changelog](https://github.com/spree/spree/blob/main/packages/admin-sdk/CHANGELOG.md) when updating.
+</Note>
## Installation
```bash
-npm install @spree/admin-sdk@next
+npm install @spree/admin-sdk
```
## Quick start
@@ -28,9 +28,9 @@ const client = createAdminClient({
secretKey: process.env.SPREE_SECRET_KEY, // sk_xxx — server-side only
})
-// List recent completed orders
+// List recently placed orders
const { data: orders, meta } = await client.orders.list({
- status_eq: 'complete',
+ status_eq: 'placed',
sort: '-completed_at',
limit: 25,
})
diff --git a/docs/developer/sdk/authentication.mdx b/docs/developer/sdk/authentication.mdx
index a8939bac89..7d12952051 100644
--- a/docs/developer/sdk/authentication.mdx
+++ b/docs/developer/sdk/authentication.mdx
@@ -27,8 +27,11 @@ For authenticated customer actions like viewing orders or managing addresses:
<AuthJwtExample />
```typescript
-// Refresh token when needed
-const newTokens = await client.auth.refresh({ token })
+// Exchange the refresh_token returned by login for a new access token.
+// The refresh token rotates, so store the new one as well.
+const { token: newToken, refresh_token: newRefreshToken } = await client.auth.refresh({
+ refresh_token: refreshToken,
+})
```
## Register New Customer
diff --git a/docs/developer/sdk/store/cart-checkout.mdx b/docs/developer/sdk/store/cart-checkout.mdx
index 0ac9dccb1c..06d122ff9a 100644
--- a/docs/developer/sdk/store/cart-checkout.mdx
+++ b/docs/developer/sdk/store/cart-checkout.mdx
@@ -28,7 +28,7 @@ const carts = await client.carts.list();
await client.carts.delete(cartId, { spreeToken: cart.token });
// Associate guest cart with authenticated user
-// (after user logs in, merge their guest cart with their account)
+// (after user logs in, assign the guest cart to their account — carts are not merged)
await client.carts.associate(cartId, {
token: jwtToken, // User's JWT token
spreeToken: cart.token, // Guest cart token
@@ -112,8 +112,8 @@ await client.carts.update(cartId, {
city: 'New York',
postal_code: '10001',
phone: '+1 555 123 4567',
- country_iso: 'US',
- state_abbr: 'NY',
+ country_code: 'US',
+ state_code: 'NY',
},
billing_address_id: 'addr_xxx', // Or use existing address by ID
}, { spreeToken: cart.token });
@@ -177,7 +177,7 @@ The cart and order responses break the amount the customer pays into these total
### Get a Completed Order
```typescript
-const order = await client.orders.get('R123456789', {
+const order = await client.orders.get('or_xxx', { // prefixed order ID (or the cart ID)
expand: ['items', 'fulfillments'],
}, { spreeToken: cart.token });
```
diff --git a/docs/developer/storefront/nextjs/emails.mdx b/docs/developer/storefront/nextjs/emails.mdx
index 172561357d..c44414fd2c 100644
--- a/docs/developer/storefront/nextjs/emails.mdx
+++ b/docs/developer/storefront/nextjs/emails.mdx
@@ -23,6 +23,10 @@ Email templates are React components in `src/lib/emails/`:
Customize a template by editing its file directly — they use `@react-email/components` for email-safe layout primitives.
+<Note>
+ The storefront listens for `order.completed` and `order.shipped`, the names these events had before Spree 6.0. Spree 6.0 still sends them alongside the new names, `order.placed` and `order.fulfilled`, but stops in Spree 6.1. Before upgrading to 6.1, switch the storefront handlers and your webhook endpoint subscriptions to the new names.
+</Note>
+
## Previewing
Run the storefront in development and open [http://localhost:3001/dev/emails](http://localhost:3001/dev/emails):
@@ -68,11 +72,11 @@ To add a new email type:
1. Create a template in `src/lib/emails/`.
2. Add a handler function in `src/lib/webhooks/handlers.ts`.
3. Register the event in `route.ts`.
-4. Subscribe to the event in **Spree Admin → Settings → Developers → Webhooks**.
+4. Subscribe to the event in **Spree Admin → Settings → Developer → Webhooks**.
## Setup
-1. **Create a webhook endpoint** in Spree Admin → Settings → Developers → Webhooks. Subscribe to `order.completed`, `order.canceled`, `order.shipped`, and `customer.password_reset_requested`, and copy the secret key into `SPREE_WEBHOOK_SECRET`.
+1. **Create a webhook endpoint** in Spree Admin → Settings → Developer → Webhooks. Subscribe to `order.completed`, `order.canceled`, `order.shipped`, and `customer.password_reset_requested`, and copy the secret key into `SPREE_WEBHOOK_SECRET`.
2. **Receive webhooks locally.** Expose the storefront with a public URL so Spree can reach it — the simplest option is a [Cloudflare Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/):
diff --git a/docs/developer/storefront/nextjs/testing.mdx b/docs/developer/storefront/nextjs/testing.mdx
index e4fa12a260..f2eba6beb0 100644
--- a/docs/developer/storefront/nextjs/testing.mdx
+++ b/docs/developer/storefront/nextjs/testing.mdx
@@ -67,7 +67,7 @@ A project scaffolded with [`create-spree-app`](/developer/create-spree-app/quick
```bash
# From the project root — build the customized backend image
-docker build -t project-spree:e2e ./backend
+docker build -t project-spree:e2e ./server
# From apps/storefront — run E2E against it
cd apps/storefront
diff --git a/docs/developer/upgrades/5.6-to-6.0.mdx b/docs/developer/upgrades/5.6-to-6.0.mdx
index 9bfc4b6e2f..bfa7a33e82 100644
--- a/docs/developer/upgrades/5.6-to-6.0.mdx
+++ b/docs/developer/upgrades/5.6-to-6.0.mdx
@@ -40,7 +40,14 @@ bundle exec rake spree:upgrade
</CodeGroup>
-Skipping versions and re-running are both safe — `bundle exec rake spree:upgrade` figures out what still needs to happen and does nothing on data that's already migrated.
+Before running `bundle update`, update your `Gemfile`: the Rails admin (`spree_admin`) and Rails storefront (`spree_storefront`) are not part of Spree 6.0. Remove both and add `spree_dashboard`, which serves the new React admin dashboard at `/dashboard`.
+
+```ruby
+# Gemfile
+gem 'spree_dashboard'
+```
+
+Re-running is safe — `bundle exec rake spree:upgrade` figures out what still needs to happen and does nothing on data that's already migrated. It also runs every data backfill from earlier upgrades (5.4 → 5.5 and 5.5 → 5.6), so any you missed along the way are caught up. That does not remove the requirement above: upgrade your application to 5.6 first.
## What the upgrade does
@@ -60,7 +67,7 @@ Every order that never completed and was never canceled becomes a `Spree::Cart`
bundle exec rake spree:migrate_adjustments_to_typed_rows
```
-Rebuilds `spree_adjustments` into `Spree::TaxLine`, `Spree::Discount` and `Spree::Fee` rows. Orders whose typed sums do not reconcile with the stored totals are left untouched and flagged (`private_metadata['typed_adjustments_frozen']`) for manual review instead of silently changing money.
+Rebuilds `spree_adjustments` into `Spree::TaxLine`, `Spree::Discount` and `Spree::Fee` rows. Orders whose typed sums do not reconcile with the stored totals are left untouched and flagged (`metadata['typed_adjustments_frozen']`) for manual review instead of silently changing money.
### Backfill fulfillment and delivery naming
@@ -98,14 +105,14 @@ Category and collection descriptions, policy bodies, and order and customer inte
Run this **after** two earlier steps, both load-bearing: the categories step re-points the rows from `Spree::Taxon` to `Spree::Category` so this one can still find them, and the customers step populates `spree_customers` — a note is copied onto the customer row it belongs to, so running before those rows exist would treat every legacy customer note as orphaned and skip it for good. Following the manifest order handles this for you.
-Content is sanitized on the way in, and **the 6.0 allowlist is much narrower than 5.6's**: it permits only what the dashboard's editor emits — paragraphs, headings, `strong`/`em`/`s`/`u`/`code`, `pre`, `blockquote`, lists, `hr`, `br` and links. Tables, images, `div`/`span`, inline `style` and arbitrary `class` attributes are no longer permitted. Text inside a stripped tag survives; its formatting does not. The exceptions are `script` and `style`, which are removed along with their contents — a script body would otherwise reappear as visible text.
+Content is sanitized on the way in, and **the 6.0 allowlist is much narrower than 5.6's**: it permits only what the dashboard's editor emits — paragraphs, headings, `strong`/`em`/`s`/`u`/`code`, `pre`, `blockquote`, lists, `hr`, `br`, links and images. Tables, `div`/`span`, inline `style` and arbitrary `class` attributes are no longer permitted. Text inside a stripped tag survives; its formatting does not. The exceptions are `script` and `style`, which are removed along with their contents — a script body would otherwise reappear as visible text.
If your descriptions rely on richer markup, permit it in an initializer **before** running the task and before saving anything under 6.0:
```ruby
# config/initializers/spree.rb
-Spree::RichTextSanitizer.allowed_tags += %w[table thead tbody tr th td img]
-Spree::RichTextSanitizer.allowed_attributes += %w[src alt colspan rowspan]
+Spree::RichTextSanitizer.allowed_tags += %w[table thead tbody tr th td]
+Spree::RichTextSanitizer.allowed_attributes += %w[colspan rowspan]
```
The Action Text rows are left in place as a rollback path and are dropped with the tables in 6.1.
@@ -157,6 +164,26 @@ Rows written before the upgrade carry an id and an empty type; this task fills
the type in. Until it runs they still read as the staff member they always
were, with a deprecation warning. Safe to re-run at any time.
+### Move users onto the Customer and AdminUser models
+
+```bash
+bundle exec rake spree:upgrade:migrate_users_to_customers
+```
+
+Copies your legacy Devise customer table (default `spree_users`) into `spree_customers`, keeping the same ids, and carries existing passwords over so customers and staff can keep signing in. The source table is left in place as a safety net.
+
+<Warning>
+ Passwords carry over only if your application **never configured a Devise pepper**. The task stops if it finds one. Because Devise is no longer loaded in 6.0, the task usually cannot check for itself — it stops until you confirm no pepper was used by re-running it with `CONFIRM_NO_PEPPER=true`. If you did use a pepper, single sign-on, or a non-bcrypt password format, skip this step and keep your own customer model by setting `Spree.customer_class`.
+</Warning>
+
+### Name countries and states by ISO code
+
+```bash
+bundle exec rake spree:upgrade:migrate_country_state_codes
+```
+
+Countries and states are no longer database records in 6.0. Addresses, delivery zone members, market countries, stock locations and stores now name them by ISO code (`country_code`, `state_code`), and this task fills those columns from the old `country_id` / `state_id` references. The old `country_iso` / `state_abbr` names still work on addresses for one release.
+
## The Cart/Order split
The single biggest change. What used to be one `Spree::Order` living through checkout and beyond is now two models:
@@ -184,17 +211,17 @@ The replacement model:
```ruby
# config/initializers/spree.rb
-Rails.application.config.to_prepare do
- Spree::Checkout::Registry.add_requirement(
- step: :payment,
- field: :po_number,
- message: 'PO number is required',
- satisfied: ->(cart) { cart.metadata['po_number'].present? },
- applicable: ->(cart) { cart.customer.present? }
- )
-end
+Spree::Checkout::Registry.add_requirement(
+ step: :payment,
+ field: :po_number,
+ message: 'PO number is required',
+ satisfied: ->(cart) { cart.metadata['po_number'].present? },
+ applicable: ->(cart) { cart.customer.present? }
+)
```
+ Register at the top level of the initializer, not inside `to_prepare`: the registry is never reset, so a `to_prepare` block would add the requirement again on every code reload in development.
+
The requirement appears in the Cart API's `requirements` array (so a storefront rendering the feed generically needs zero changes) *and* blocks completion. `register_step` adds whole steps (spliced into `checkout_steps` at `before:`/`after:` anchors); built-in steps are customized through `Registry.base_steps` — an ordered `{ name => applicability }` hash you can mutate directly (`base_steps.delete('confirm')`).
- **The API `requirements` array now carries a stable `code`** on every entry (`email_required`, `out_of_stock`, `guest_checkout_not_allowed`, ...). Additive change — existing consumers keep working.
- **The delivery requirement is keyed `delivery_method`, not `shipping_method`.** Its entry is now `{ step: 'delivery', field: 'delivery_method', code: 'delivery_method_required' }`. A storefront that renders the feed generically needs no change; one that keys off the field or code to highlight a specific input must switch both tokens. The `Spree.t('checkout_requirements.shipping_method_required')` translation key was renamed to `checkout_requirements.delivery_method_required` — override it under the new key.
@@ -215,7 +242,7 @@ Behavior to review:
Transition-triggered recalculation is gone with the machine. Instead:
-- **`Spree::Carts::RecalculateTotals`** is the single totals seam: money inputs, typed-row regeneration (promotions via the winner-only adjuster, tax via `Spree.tax_provider`), folding and one persist. It runs on the writes that matter — item changes, address/market changes (which also re-price items and rebuild delivery proposals) — not on step transitions.
+- **`Spree::Carts::RecalculateTotals`** is the single totals seam: money inputs, typed-row regeneration (promotions via the winner-only adjuster, tax via the market's tax provider, falling back to `Spree.default_tax_provider`), folding and one persist. It runs on the writes that matter — item changes, address/market changes (which also re-price items and rebuild delivery proposals) — not on step transitions.
- Promotion eligibility is evaluated against **current** totals in the same recalculation — a cart crossing a coupon threshold gets the discount on that recalculation, not the next one.
- **Completed orders are money-frozen.** Typed rows are never regenerated post-placement; recalculation only re-sums them. Post-placement money edits go through the explicit admin services (`Orders::Discounts::*`, `Orders::Fees::*`), which write rows and re-sum.
- `Spree::OrderUpdater` and `Spree::CartUpdater` remain as deprecated shells — every method warns and runs the full recalculation. Removed in 6.1.
@@ -295,10 +322,15 @@ Core ships exactly one policy rule — a return window read from `market.preferr
Replace it by swapping the handler:
```ruby
-Spree.hooks.unregister('returns.create.validate', 'Spree::Returns::EligibilityValidator')
-Spree.hooks.register('returns.create.validate', 'MyStore::ReturnPolicy')
+# config/initializers/spree.rb
+Rails.application.config.after_initialize do
+ Spree.hooks.unregister('returns.create.validate', 'Spree::Returns::EligibilityValidator')
+ Spree.hooks.register('returns.create.validate', 'MyStore::ReturnPolicy')
+end
```
+Wrap the swap in `after_initialize`: core registers the default validator after your initializers load, so an `unregister` at the top level of an initializer would run too early and do nothing.
+
A handler receives the workflow (so it can read `order`, `items`, `created_by`, `order.market`) and calls `workflow.reject!(message)` to veto. Every one of the fifteen transitions has a leading `validate` hook, so the same seam gates approving, receiving and refunding.
<Warning>
@@ -329,7 +361,7 @@ A handler receives the workflow (so it can read `order`, `items`, `created_by`,
| `carts_complete_service` | `carts_complete_workflow` | `Spree::Carts::Complete` |
| `order_cancel_service` | `order_cancel_workflow` | `Spree::Orders::Cancel` |
| `order_complete_service` | `order_complete_workflow` | `Spree::Orders::Complete` |
-| `shipment_update_service` | `fulfillment_update_service` | `Spree::Fulfillments::Update` |
+| `shipment_update_service`, `fulfillment_update_service` | `fulfillment_update_workflow` | `Spree::Fulfillments::Update` |
New seams with no legacy counterpart:
@@ -593,7 +625,7 @@ to `Spree::Base`.
`Spree::StateChange` and `Spree::LogEntry` are removed — the models, the `state_changes` associations on `Order`, `Payment` and `Fulfillment`, the `log_entries` associations on `Payment` and `Refund`, and everything that wrote to them. Both were write-only: nothing in Spree read the rows back, and the admin screens that displayed them are gone.
-**Events are the audit trail now.** Instead of querying state-change rows, subscribe to the lifecycle events that already fire on every meaningful transition: `order.placed`, `order.canceled`, `payment.completed`, `payment.voided`, `fulfillment.ready`, `fulfillment.fulfilled`, `fulfillment.canceled`, `fulfillment.resumed`, and the rest. If you need a persistent history, write it from a subscriber.
+**Events are the audit trail now.** Instead of querying state-change rows, subscribe to the lifecycle events that already fire on every meaningful transition: `order.placed`, `order.canceled`, `payment.completed`, `payment.voided`, `fulfillment.fulfilled`, `fulfillment.delivered`, `fulfillment.canceled`, and the rest. If you need a persistent history, write it from a subscriber.
**Gateway responses are no longer stored in your database.** `LogEntry` kept every gateway response as serialized YAML. For transaction forensics, use your payment provider's dashboard — `Payment#gateway_dashboard_payment_url` links straight to the transaction — or `Spree::PaymentSession`, which holds the gateway-side state for session-based providers.
@@ -632,7 +664,8 @@ Every rename keeps the legacy name working for one release with a deprecation wa
| `Spree::PresentationTranslatable` | `Spree::LabelTranslatable` |
| `Spree::WishedItem`, `Wishlist#wished_items`, `#wished_items_count` | `Spree::WishlistItem`, `#wishlist_items`, `#wishlist_items_count` (class and table renamed; the `wi_` prefixed IDs are unchanged, so client-held IDs keep resolving) |
| `use_billing` / `clone_billing_address` | `use_shipping` (shipping address is canonical) |
-| `Fulfillment#ship`, `#ship!`, `#shipped?`, `#can_ship?`, `#shipping_method`, `#add_shipping_method` | `#fulfill`, `#fulfill!`, `#fulfilled?`, `#can_fulfill?`, `#delivery_method`, `#add_delivery_method` |
+| `Fulfillment#ship`, `#ship!` | `Spree.fulfillment_fulfill_workflow.call(fulfillment:)` (`Spree::Fulfillments::Fulfill`) |
+| `Fulfillment#shipped?`, `#can_ship?`, `#shipping_method`, `#add_shipping_method` | `#fulfilled?`, `#can_fulfill?`, `#delivery_method`, `#add_delivery_method` |
| `LineItem#target_shipment` | `#target_fulfillment` |
| `Order#create_proposed_shipments` / `#create_proposed_fulfillments` | `#rebuild_fulfillments!` (Cart ships with the new name only) |
| `Order#remove_out_of_stock_items!` | cart-side only (`Spree::Carts::RemoveOutOfStockItems`) |
diff --git a/docs/integrations/search/meilisearch.mdx b/docs/integrations/search/meilisearch.mdx
index 60dd3e8cef..9078d2cda8 100644
--- a/docs/integrations/search/meilisearch.mdx
+++ b/docs/integrations/search/meilisearch.mdx
@@ -5,7 +5,7 @@ description: "Set up Meilisearch in Spree for fast, typo-tolerant product search
## Overview
-[Meilisearch](https://www.meilisearch.com/) is a fast, open-source search engine that provides typo tolerance, relevance ranking, faceted filtering, and sub-50ms search responses. Spree includes a built-in Meilisearch search provider that replaces the default SQL-based search.
+[Meilisearch](https://www.meilisearch.com/) is a fast, open-source search engine that provides typo tolerance, relevance ranking, faceted filtering, and sub-50ms search responses. The official `spree_meilisearch` gem provides a Meilisearch search provider that replaces the default SQL-based search.
**When to use Meilisearch:**
- Catalogs with 1,000+ products
@@ -52,7 +52,7 @@ For local development, Meilisearch runs without authentication by default — no
### 2. Add the gem to your Gemfile
```ruby
-gem 'meilisearch', '>= 0.28'
+gem 'spree_meilisearch'
```
<CodeGroup>
@@ -83,7 +83,7 @@ MEILISEARCH_URL=http://localhost:7700
```ruby
# config/initializers/spree.rb
-Spree.search_provider = 'Spree::SearchProvider::Meilisearch'
+Spree.search_provider = 'SpreeMeilisearch::SearchProvider'
```
### 5. Index your products
@@ -226,7 +226,7 @@ The Meilisearch provider automatically configures these filterable attributes:
- `name` — product name (in document locale)
- `description` — product description (in document locale)
- `sku` — variant SKU
-- `option_values` — option value presentations (e.g., "Red", "Small")
+- `option_values` — option value labels (e.g., "Red", "Small")
- `category_names` — category names
- `tags` — product tags