St. Croix Rod
Pre-Book · Phase 1

End-to-End Flow & System Behavior

What happens between a user clicking Save and an order existing in Shopify — the five places pre-book data lives, the two payload paths, and the seven things the backend still has to confirm.

Document03 of 04
DeliverableEnd-to-end flow
Data stores5
Payload paths2 — save, submit
Open confirmations7
Section 01

System map

Pre-book is a storefront experience with a backend handoff, not an application with a database. That distinction shapes everything in this document. There is no single system of record; there are five places data lives, each with a different lifetime and a different owner, and the program — the object the entire tool exists to manage — lives in the one that was never designed to hold it.

Two payload paths leave the storefront: save, which happens many times per program, and submit, which happens once and is final.

Section 02

Where the data lives

Browser session active mode selected dealer gone on expiry Shopify cart the order being assembled right now cleared on save Customer metafields SYSTEM OF RECORD every saved order program state, totals last write wins Theme settings windows, thresholds caps, all copy edited by hand Shopify orders created only at submit LOST ON REFRESH PERMANENT RECORD The entire pre-book program sits in customer metafields — a Shopify field designed to annotate a customer, holding a season's wholesale order
Fig. 3.1  Data residence, arranged by durability. The load-bearing choice in the whole system is that customer metafields serve as the system of record for saved program data. That worked for a proof of concept. As pre-book has become a primary B2B channel, it has become the technical risk most worth naming.
System risk

Metafields have practical size limits, no transactional guarantees, and last-write-wins semantics. A large program, or a rep and a dealer touching the same program in the same window, is exactly the shape of problem metafields handle worst. This does not need solving in Phase 2, but Phase 3 cannot be scoped honestly without a decision on it — see CONF-08.

Section 03

Save vs. submit

The two paths share a shape but not a consequence. Save is repeatable and reversible. Submit creates real orders, sends real email, and cannot be undone from the tool.

User Storefront Shopify cart Metafields Backend Shopify orders Email Save path runs many times per program · reversible Submit path runs once · irreversible Clicks Save order Storefront assembles the save payload dealer · items · ship date · PO · note · program state Cart cleared Saved order N written program total recalculated Backend keeps state aligned reads and updates saved program data — nothing created — — nothing sent — Clicks Submit orders no review step in front of it Storefront assembles the final payload the whole program, every saved order — not involved — Program state read, marked complete no longer treated as an editable draft Backend interprets and acts decides pre-book vs. rep order · creates orders resolves SKUs · triggers notifications Shopify order created Dealer confirmation standard Shopify email Rep confirmation custom, sent by backend
Fig. 3.2  Save and submit compared. Note the asymmetry at the bottom: the save path touches nothing permanent and sends nothing, while a single click on the submit path creates orders and fires two independent email systems. The gap between those two levels of consequence is currently marked in the interface by nothing at all.
Section 04

The payload

What leaves the storefront when a user saves or submits.

ElementPurposeSaveSubmit
Request typeTells the backend whether this is a pre-book request or a regular rep orderYesYes
Dealer identityWho the order belongs toYesYes
Rep identityWho placed it, when a rep is actingYesYes
Line itemsSKUs and quantitiesYesYes
Ship dateThe chosen date inside the allowed windowYesYes
PO numberDealer's own referenceYesYes
NoteFree text from the rep or dealerYesYes
Program stateThe customer-linked program the storefront has been maintainingYesYes — complete set
Not yet documented

The exact field or flag that distinguishes a pre-book request from a regular rep order is known to the code but not written down anywhere. It is the single most important undocumented item in the system, because every branch on the backend hangs off it. See CONF-05.

Section 05

Backend responsibilities

In the current implementation the backend service owns six jobs.

ResponsibilityDetail
Order creationCreates Shopify orders when a program is submitted.
Dealer notificationLets Shopify send its normal dealer confirmation off the created order.
Rep notificationSends a separate custom rep-facing confirmation when one is needed.
Program stateReads and updates saved program data in customer metafields, but only for requests it treats as pre-book.
State alignmentKeeps storefront and backend agreeing on the current saved-order state.
SKU resolutionResolves uploaded CSV SKUs into valid, draft, unavailable, or missing.
Section 06

Pre-book vs. rep order

The backend does not treat every rep request the same way, and the distinction is consequential: a pre-book request is permitted to read and write saved program data, while a regular rep order should not touch that path at all.

RequestProgram dataExpected behavior
Pre-book submissionRead and writeFull program lifecycle: saved orders, totals, completion
Regular rep orderMust not use the saved-state pathBehaves like a standard order flow
Failure mode

If a regular rep order is misclassified as pre-book, it can read or overwrite a dealer's live program state. If a pre-book submission is misclassified as a regular order, the program is never marked complete. Neither failure is loud. Documenting and hardening this discriminator is a prerequisite for Phase 3, not a detail of it.

Section 07

Email split

Submission produces two confirmations from two independent systems.

RecipientSent byConsequence
Dealer / customerShopify, off the created orderLooks like a normal Shopify order confirmation — not like a pre-book program acknowledgment. The dealer receives a transactional receipt for a seasonal buying commitment.
RepBackend, customSeparate template, separate delivery path, separate failure mode. It can fail silently while the dealer's email succeeds, or vice versa.
Phase 2 note

The dealer confirmation is the last thing a dealer sees in the workflow and the only artifact they keep. Making it a genuine program acknowledgment — the whole program, its orders, ship windows, PO references, and totals, in St. Croix's voice — is one of the highest-leverage, lowest-cost improvements available. See PB-SUB-04.

Section 08

Change events

Five events reshape the system's state mid-session. Each has a defined technical behavior and, in most cases, no defined user-facing behavior.

EventSystem behaviorUser-facing behavior
Dealer changedWorking context resets so nothing attaches to the wrong dealerUndefined — no warning documented
Pre-book turned offSession state cleared; cart returns to standard checkoutUndefined — no warning documented
Program total changedThreshold status recalculated; available ship dates may narrowStatus message updates; the ship-date consequence is not explained
Saved order editedOrder re-hydrated into cart; remains part of the program until re-saved or deletedLoading screen, then a populated cart
Program submittedProgram marked complete; final payload sent; orders createdUndefined post-submit state — no confirmation surface
Section 09

Needs confirmation

Eight items the storefront cannot answer. Each is listed with what it blocks, so they can be triaged rather than treated as one undifferentiated list. Items marked P0 block Phase 3 estimation.

IDQuestionWhat it blocksOwnerPri
CONF-01Where does the final submission land after it leaves the storefront?Integration design for the future B2B platformBackendP0
CONF-02Does the backend notify in every case, or only some?Notification design; failure handlingBackendP1
CONF-03Orders, draft orders, or program data only — and in which scenarios?Whether an amend path is even possibleBackendP0
CONF-04Does the backend update ERP or any other system?Phase 3 scope and integration costSt. Croix ITP0
CONF-05Which flag tells the backend pre-book from regular order?Every backend branch; hardening workBackendP0
CONF-06How are rep and dealer identifiers used downstream?Rep attribution, reporting, commissionBackendP1
CONF-07What happens on submission with missing or empty rep information?Error design; data integrityBackendP1
CONF-08Do metafields remain the system of record for program data?Phase 3 architecture and its cost bandJoint decisionP0
Recommendation

CONF-01, 03, 04, 05 and 08 should be closed in a single working session with St. Croix IT and whoever owns the Lambda before Phase 3 is priced. They are five questions, not five weeks of work — but until they are answered, any Phase 3 number is a guess with a wide band.