Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Dual-emit order.completed alongside order.placed for one release
Damian Legawiec9cefc121428a
diff --git a/docs/plans/6.0-cart-order-split.md b/docs/plans/6.0-cart-order-split.mdindex 782330aaa3..273824f84a 100644--- a/docs/plans/6.0-cart-order-split.md+++ b/docs/plans/6.0-cart-order-split.md@@ -67,7 +67,7 @@ Every competitor treats this as load-bearing. `Spree::Carts::Complete`:- Cancel/resume/approve remain services (`Orders::Cancel`/`Resume`/`Approve` — approve is already machine-free) flipping `status` and running today's side effects (restock/void/refund branches preserved verbatim). `awaiting_return`/`returned` states are **not** carried over — that lifecycle belongs to `6.0-returns-exchanges-claims.md`'s first-class Return models.- The `confirmation_required?` self-reference (the `|| confirm?` hack from #4117) dies with the machine: whether the confirm/review step exists is computed **from data only** (`Spree::Config[:always_include_confirm_step]` or any selected payment method requiring confirmation). A confirm-stage failure no longer "falls back" to an earlier state — there are no states; the client stays on review with the failure in `requirements`/errors.- Order `state_changes` audit rows are dropped in favor of lifecycle events (`order.placed`, `order.canceled`, `order.resumed`, `order.approved` — already published today). Payment/fulfillment machines keep their own `StateChange` rows.-- **Event naming after the split (settled 2026-07-29, revised same day):** carts publish their own `cart.created` / `cart.updated` / `cart.deleted` lifecycle events (restoring the 5.x abandonment signal that incomplete orders' `order.*` events used to provide; Shopify `carts/*` parity). The placement event is **`order.placed`** — renamed from the historical `order.completed` (Medusa's exact term; avoids Medusa's `order.completed` = "fulfillment finished" collision and reads right to newcomers, the primary audience — accepted as a 6.0 breaking change for existing webhook consumers). `order.created` cannot take that role because it fires for every order row, including admin drafts and the pre-payment draft copy inside `Carts::Complete` (a failed payment then emits `order.deleted` for it). Admin confirmation resends publish the targeted `order.resend_confirmation_email`, no longer re-blasting the placement event to all consumers. The order event payload carries `cart_id` so abandonment tooling can cancel flows on conversion (BigCommerce `store/cart/converted` parity).+- **Event naming after the split (settled 2026-07-29, revised same day):** carts publish their own `cart.created` / `cart.updated` / `cart.deleted` lifecycle events (restoring the 5.x abandonment signal that incomplete orders' `order.*` events used to provide; Shopify `carts/*` parity). The placement event is **`order.placed`** — renamed from the historical `order.completed` (Medusa's exact term; avoids Medusa's `order.completed` = "fulfillment finished" collision and reads right to newcomers, the primary audience). 6.0 dual-emits the legacy name with `deprecated_alias_of` metadata; dropped in 6.1. `order.created` cannot take that role because it fires for every order row, including admin drafts and the pre-payment draft copy inside `Carts::Complete` (a failed payment then emits `order.deleted` for it). Admin confirmation resends publish the targeted `order.resend_confirmation_email`, no longer re-blasting the placement event to all consumers. The order event payload carries `cart_id` so abandonment tooling can cancel flows on conversion (BigCommerce `store/cart/converted` parity).- **Price-freeze guarantee** (what OSS platform C's `ArrangingPayment` lock provided): `completing_at` rejects cart mutations while payment is in flight, and the completed Order is immutable per split-adjustments' order-level freeze. Auditable price-at-completion also serves EU Omnibus.### 7. Cart hygiene — new, and newly necessarydiff --git a/docs/plans/decisions.md b/docs/plans/decisions.mdindex 5d954d4136..434a59d628 100644--- a/docs/plans/decisions.md+++ b/docs/plans/decisions.md@@ -605,10 +605,12 @@ a direct collision with our historical name.**Decisions:** carts publish `cart.created/updated/deleted` (5.xabandonment-signal parity). The placement event is renamed-`order.completed` → **`order.placed`** — a deliberate 6.0 breaking change:-newcomers are the primary audience and the old name misleads anyone-arriving from Medusa; existing webhook consumers adjust one subscription-on upgrade. `order.created` keeps meaning "order row exists" (admin drafts+`order.completed` → **`order.placed`** — newcomers are the primary+audience and the old name misleads anyone arriving from Medusa. Per the+one-release bridge convention, 6.0 dual-emits: `order.completed` still+fires with an identical payload and `deprecated_alias_of: 'order.placed'`+in the event metadata (wildcard subscribers dedupe on it); the alias is+dropped in 6.1. The dashboard event picker offers only `order.placed`. `order.created` keeps meaning "order row exists" (admin draftsincluded). Admin confirmation resends publish the targeted`order.resend_confirmation_email` instead of re-blasting the placementevent. Order payloads carry `cart_id` (BigCommerce `store/cart/converted`diff --git a/spree/core/app/models/spree/order.rb b/spree/core/app/models/spree/order.rbindex e1ad776a89..58a4271c0f 100644--- a/spree/core/app/models/spree/order.rb+++ b/spree/core/app/models/spree/order.rb@@ -1277,7 +1277,11 @@ module Spreeenddef publish_order_placed_event- publish_event('order.placed', event_payload.merge(notify_customer: notify_customer))+ payload = event_payload.merge(notify_customer: notify_customer)+ publish_event('order.placed', payload)+ # One-release alias for 5.x webhook consumers; removed in 6.1.+ # Wildcard subscribers dedupe on the metadata marker.+ publish_event('order.completed', payload, { deprecated_alias_of: 'order.placed' })enddef publish_order_resumed_eventdiff --git a/spree/core/spec/models/spree/order_spec.rb b/spree/core/spec/models/spree/order_spec.rbindex d99595f22a..0ccfef56c7 100644--- a/spree/core/spec/models/spree/order_spec.rb+++ b/spree/core/spec/models/spree/order_spec.rb@@ -473,6 +473,7 @@ describe Spree::Order, type: :model doit 'publishes order.completed event' doexpect(order).to receive(:publish_event).with('order.placed', hash_including(:notify_customer)).at_least(:once)+ expect(order).to receive(:publish_event).with('order.completed', hash_including(:notify_customer), { deprecated_alias_of: 'order.placed' }).at_least(:once)allow(order).to receive(:publish_event).with(anything)allow(order).to receive(:publish_event).with(anything, anything)order.finalize!diff --git a/spree/emails/spec/models/spree/order_spec.rb b/spree/emails/spec/models/spree/order_spec.rbindex e6eb4a7ddd..97e909ba00 100644--- a/spree/emails/spec/models/spree/order_spec.rb+++ b/spree/emails/spec/models/spree/order_spec.rb@@ -14,6 +14,7 @@ describe Spree::Order, type: :model doit 'publishes order.placed event when finalizing', events: true doexpect(order).to receive(:publish_event).with('order.placed', hash_including(:notify_customer))+ expect(order).to receive(:publish_event).with('order.completed', hash_including(:notify_customer), { deprecated_alias_of: 'order.placed' })allow(order).to receive(:publish_event).with(anything)allow(order).to receive(:publish_event).with(anything, anything)