@spree/docs 0.1.252 → 0.1.254

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -711,7 +711,7 @@ Endpoints marked — are exempt from scope checks (authentication and session en
711
711
  | Method | Path | Required scope | Summary |
712
712
  |---|---|---|---|
713
713
  | `GET` | `/translations` | `read_products` | Translation coverage for a resource type |
714
- | `POST` | `/translations/batch` | *write_<resource> for every resource type in the batch (for API-key authentication)* | Batch upsert translations |
714
+ | `POST` | `/translations/batch` | *write_&lt;resource&gt; for every resource type in the batch (for API-key authentication)* | Batch upsert translations |
715
715
 
716
716
  ## Webhook endpoints
717
717
 
@@ -280,6 +280,10 @@ Completing a cart moves real money, so Spree is careful about it:
280
280
 
281
281
  **Totals are worked out at the last moment.** The amount charged is calculated when the cart is completed, not taken from an earlier request — so a price or promotion that changed while the customer was reviewing can't lead to the wrong charge.
282
282
 
283
+ **The order keeps what the cart collected.** The customer, addresses, items, notes, purchase order number, tax identifier and the cart's `metadata` are all copied onto the order. When a checkout is split into one order per seller, every one of those orders receives the same copy. After that the cart and the order are independent — changing one never changes the other.
284
+
285
+ > **WARNING:** A customer can write a cart's `metadata` through the Store API, so once it is copied onto the order, treat those keys as customer input. Do not keep anything there that your own code later trusts, such as a fraud or approval flag.
286
+
283
287
  If a cart can't be completed you get told why — a payment failure, or unmet [requirements](#checkout-requirements) — and the cart is left alone so the customer can fix it and try again.
284
288
 
285
289
  ## Abandoned carts
@@ -5,7 +5,7 @@ description: How Spree models orders — a permanent record created by completin
5
5
 
6
6
  ## Overview
7
7
 
8
- An order is a placed purchase. It's created by completing a [Cart](carts.md) and holds its own copy of everything the customer agreed to — items, prices, taxes, discounts and delivery.
8
+ An order is a placed purchase. It's created by completing a [Cart](carts.md) and holds its own copy of everything the customer agreed to — items, prices, taxes, discounts and delivery. Anything your storefront stored in the cart's `metadata` is copied onto the order too, including onto every order of a checkout split between sellers.
9
9
 
10
10
  ```mermaid
11
11
  erDiagram
@@ -41,6 +41,11 @@ Spree::Checkout::Registry.add_requirement(
41
41
  While `satisfied:` returns false the cart reports the requirement and refuses to
42
42
  complete. Its `code` is derived as `<field>_required` — `vat_number_required` here.
43
43
 
44
+ The storefront satisfies it by writing the value into the cart's `metadata`. When the
45
+ cart is completed, its `metadata` is copied onto the order — onto every order if the
46
+ checkout is split between sellers — so the VAT number is still there after placement as
47
+ `order.metadata['vat_number']`.
48
+
44
49
  Pass `applicable:` to scope it. It is checked before `satisfied:`, so a requirement
45
50
  that doesn't apply never appears at all:
46
51
 
@@ -30,7 +30,7 @@ Spree Backend → Webhook POST → Storefront → render email → send via Rese
30
30
 
31
31
  1. **Create a webhook endpoint** in Spree Admin → Settings → Developer → Webhooks:
32
32
  - **URL:** `https://your-storefront.com/api/webhooks/spree`
33
- - **Events:** `order.completed`, `order.canceled`, `order.shipped`, `customer.password_reset_requested`, `newsletter_subscriber.subscription_requested`
33
+ - **Events:** `order.placed`, `order.canceled`, `order.fulfilled`, `customer.password_reset_requested`
34
34
 
35
35
  2. **Configure the storefront** with the webhook secret and email provider:
36
36
 
@@ -49,13 +49,12 @@ Spree Backend → Webhook POST → Storefront → render email → send via Rese
49
49
 
50
50
  | Event | Email |
51
51
  |-------|-------|
52
- | `order.completed` | Order confirmation with items, totals, addresses |
52
+ | `order.placed` | Order confirmation with items, totals, addresses |
53
53
  | `order.canceled` | Cancellation notice |
54
- | `order.shipped` | Shipping notification with tracking link |
54
+ | `order.fulfilled` | Shipping notification with tracking link |
55
55
  | `customer.password_reset_requested` | Password reset link |
56
- | `newsletter_subscriber.subscription_requested` | Newsletter double opt-in confirmation link |
57
56
 
58
- > **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.
57
+ > **NOTE:** Spree 6.0 also sends the pre-6.0 names `order.completed` and `order.shipped` as deprecated aliases until 6.1. Subscribe the endpoint to the new names only — subscribing to both makes Spree deliver both events.
59
58
 
60
59
  #### Custom Frameworks
61
60
 
@@ -16,14 +16,14 @@ Email templates are React components in `src/lib/emails/`:
16
16
 
17
17
  | File | Event | Description |
18
18
  |------|-------|-------------|
19
- | `order-confirmation.tsx` | `order.completed` | Items, totals, addresses, delivery method |
19
+ | `order-confirmation.tsx` | `order.placed` | Items, totals, addresses, delivery method |
20
20
  | `order-canceled.tsx` | `order.canceled` | Cancellation notice with items |
21
- | `shipment-shipped.tsx` | `order.shipped` | Tracking number and link |
21
+ | `shipment-shipped.tsx` | `order.fulfilled` | Tracking number and link |
22
22
  | `password-reset.tsx` | `customer.password_reset_requested` | Reset button and fallback link |
23
23
 
24
24
  Customize a template by editing its file directly — they use `@react-email/components` for email-safe layout primitives.
25
25
 
26
- > **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.
26
+ > **NOTE:** Spree 6.0 also sends the pre-6.0 names `order.completed` and `order.shipped` as deprecated aliases until 6.1. Subscribe the endpoint to the new names only — subscribing to both makes Spree deliver both events.
27
27
 
28
28
  ## Previewing
29
29
 
@@ -57,9 +57,9 @@ import { createWebhookHandler } from '@/lib/spree/webhooks'
57
57
  const handler = createWebhookHandler({
58
58
  secret: process.env.SPREE_WEBHOOK_SECRET!,
59
59
  handlers: {
60
- 'order.completed': handleOrderCompleted,
60
+ 'order.placed': handleOrderPlaced,
61
61
  'order.canceled': handleOrderCanceled,
62
- 'order.shipped': handleOrderShipped,
62
+ 'order.fulfilled': handleOrderFulfilled,
63
63
  'customer.password_reset_requested': handlePasswordReset,
64
64
  },
65
65
  })
@@ -74,7 +74,7 @@ To add a new email type:
74
74
 
75
75
  ## Setup
76
76
 
77
- 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`.
77
+ 1. **Create a webhook endpoint** in Spree Admin → Settings → Developer → Webhooks. Subscribe to `order.placed`, `order.canceled`, `order.fulfilled`, and `customer.password_reset_requested`, and copy the secret key into `SPREE_WEBHOOK_SECRET`.
78
78
 
79
79
  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/):
80
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spree/docs",
3
- "version": "0.1.252",
3
+ "version": "0.1.254",
4
4
  "description": "Spree Commerce developer documentation for AI agents and local reference",
5
5
  "type": "module",
6
6
  "license": "CC-BY-4.0",