Bare Necessities
Preorder & Backorder Sync / Architecture & Scenarios
Internal Reference & Architecture

How a preorder becomes a real order

Four scenarios covering how Movex, Barrett, Techsera, Shopify, and STOQ stay in sync — from a purchase order landing in the ERP to customer delivery.

1
Movex
ERP / Source of truth
2
Barrett
Warehouse / Physical
3
Techsera
Integration / Bridge
4
Shopify
Storefront & Holds
5
STOQ
Preorder Limits
Topology & Roles

Who does what across the stack

Each component maintains a strict single responsibility boundary to prevent race conditions and out-of-sync inventory numbers.

ERP

Movex

ERP where purchase orders (POs) originate and expected inventory is created. Has zero concept of Shopify or preorder rules.

Warehouse

Barrett

Physical warehouse. Receives and checks in physical shipment units against open POs.

Integration Layer

Techsera

Integration middleware. Responsible for writing inventory deltas and PO signal triggers into Shopify.

Storefront & Orders

Shopify

Tracks available vs committed stock natively. Holds and releases fulfillment orders on inventory adjustments.

Preorder Engine

STOQ

Decides preorder button eligibility, applies checkout holds, and strictly enforces the customer sell limit.

Scenario 01

New PO arrives in Movex

TRIGGER: PO registered in ERP — zero physical units have arrived yet.
1
MOVEX
PO is created — quantity and expected ship date are recorded. No physical stock exists yet.
2
TECHSERA
Writes the incoming quantity to the variant's backorder.incoming_po_quantity metafield via Shopify's GraphQL API (metafieldsSet) — this value is set/overwritten each time, not accumulated. It exists only to carry this one PO's quantity and trigger the next step.
Shopify — metafieldsSet Mutation
View GraphQL Request Payload
# Definition ID: gid://shopify/MetafieldDefinition/214024749169
mutation SetIncomingPOQuantity($metafields: [MetafieldsSetInput!]!) {
  metafieldsSet(metafields: $metafields) {
    metafields {
      id
      namespace
      key
      value
      type
    }
    userErrors {
      field
      message
      code
    }
  }
}

# GraphQL Variables:
{
  "metafields": [
    {
      "ownerId": "gid://shopify/ProductVariant/{{variant_id}}",
      "namespace": "backorder",
      "key": "incoming_po_quantity",
      "value": "100",
      "type": "number_integer"
    }
  ]
}
3
SHOPIFY FLOW
Detects the metafield change via the Workflow Trigger Extensions app (Flow has no native metafield-change trigger) and kicks off the read → calculate → write sequence in steps 4–5.
4
STOQ
Current preorder_max_count is read for that variant — the update endpoint sets an absolute value, so the current limit has to be queried first.
STOQ — Read Variant Limit API
5
STOQ
New absolute limit is written: current limit + incoming PO quantity.
STOQ — Update Variant Settings PATCH
Interactive Math Simulator Edit numbers
Current Limit
New PO Qty
180
New STOQ Limit
Result & System State

The preorder limit immediately reflects incoming stock. Physical inventory and order holds are completely untouched at this stage.

The metafield itself is transient — it only exists to trigger this sequence; the real accumulated value lives in STOQ's preorder_max_count.

Scenario 02

Stock arrives & covers everything

TRIGGER: Physical stock arrives at Barrett and exceeds all sold preorders.
1
BARRETT
Receives the physical shipment of units into warehouse storage.
2
TECHSERA
Pushes received quantity directly to Shopify as an inventory delta — no state lookup required.
Shopify — inventoryAdjustQuantities Mutation
3
SHOPIFY
Available turns positive natively as inventory increases. Committed does not drop automatically — the held orders are still on hold until something explicitly releases them.
4
SHOPIFY FLOW
Triggered by the inventory change (inventoryQuantityPrior <= 0 AND inventoryQuantity > 0), queries the fulfillment orders on hold for this variant, filters to holds placed specifically by STOQ (heldByApp.id), and releases only those — never a blanket release, to avoid touching holds from other apps (e.g. a payment hold).
Shopify — fulfillmentOrderReleaseHold Mutation
5
STOQ
Flips the CTA from "Preorder" to "Add to Cart" automatically once available > 0. Independent of the hold release above — this is purely a storefront display change.
Inventory Math Simulator Edit numbers
Committed (Preorders)
Units Received
30
Real Available
PRECONDITION: Split Fulfillments must be enabled on the STOQ offer so multi-line orders can release this variant independently without prematurely releasing other items on backorder.
Preorder Limit Is Not Touched

Both the limit and sold tally remain accurate in STOQ history. There is nothing to reset or recalculate.

Scenario 03

Stock arrives & covers only part

TRIGGER: Partial shipment arrives at Barrett (units < committed orders).
1
BARRETT
Receives fewer physical units than the currently committed preorder volume.
2
TECHSERA
Pushes the received quantity delta to Shopify inventory, exactly like Flow 2.
3
SHOPIFY
Committed drops by exactly the arrived units. Available stays 0 — pending preorders wait in queue.
4
STOQ
Variant correctly stays in Preorder mode on the storefront because available inventory remains 0.
Partial Split Simulator Edit numbers
Committed
Units Arrived
10
Still Pending
CRITICAL RULE: Do not reduce the limit proportionally (e.g., dropping 80 to 20 because 60 arrived). STOQ’s recalculate tool counts fulfilled orders and a zero-reset destroys active orders.
Preorder Limit Is Not Touched

The math holds whether inventory arrives in a single batch or multiple split shipments.

Scenario 04 — Under Investigation

PO registered on an in-stock item

STATUS: OPEN / UNDER INVESTIGATION — Single static push model breaks on event ordering.
The Conflict: Static Push Cannot Handle Event Ordering

A single static limit update set once when the PO arrives cannot correctly accommodate both possible real-world event sequences:

  • Case A (PO physically arrives before stock sells out): If the limit was bumped at registration, when physical stock arrives it increases available inventory, but the STOQ limit remains inflated — allowing overselling beyond real PO backing later.
  • Case B (Stock sells out before PO physically arrives): If the limit was untouched while stock was positive, the variant transitions into preorder with limit 0 — improperly blocking sales when a valid PO is actually on the way.
Direction Under Investigation

Instead of pushing the limit when the PO is registered in Movex, defer the calculation until the variant actually transitions into preorder (stock reaches 0). At that exact moment, query the remaining outstanding PO quantity (registered but not yet physically received) and write that as the active STOQ limit.

Key Architectural Question

Can we query outstanding (registered-but-not-yet-received) PO quantity per variant on demand at any point in time?

This capability is currently unconfirmed and must be validated with Techsera/Movex API capabilities before finalizing Scenario 4.

Timing Comparison
Static Push (Broken): Set limit on PO registration → creates inflation or stockout traps.

🔍 Dynamic JIT (Investigating): Stock reaches 0 → Query outstanding POs → Set STOQ limit dynamically.
Comparison Matrix

Summary of the 4 Scenarios

The first two only ever affect the preorder limit. The next two only ever affect what happens to orders already on hold — never both at once.

SCENARIO 1 PO Arrives →

Preorder Limit Increment

Movex PO → Techsera → STOQ Limit (+PO Qty). No physical stock changes.

Modifies: Preorder Limit Only
SCENARIO 2 Full Stock →

Full Order Release

Barrett receipt → Shopify Inventory Delta. Committed released, Available turns positive.

Modifies: Order Holds (Limit Untouched)
SCENARIO 3 Partial Stock →

Partial Order Release

Committed drops by arrival count. Available stays 0. Preorders continue taking orders.

Modifies: Order Holds (Limit Untouched)
SCENARIO 4 Investigating ⚠

PO on In-Stock Item (Event Ordering Conflict)

Static limit update causes inflation (Case A) or 0-limit lockouts (Case B). Investigating dynamic calculation upon stock reaching 0.

Status: Open / Under Investigation
Implementation Readiness

What's confirmed, what's open

Engineering validation status as of latest integration checks (STOQ confirmation Sept 2).

CONFIRMED

Shopify native available/committed math handles Flows 2 and 3

Nothing needs to be custom-built to track allocation — this is built-in Shopify inventory functionality.

CONFIRMED

Shopify Flow "Send HTTP request" can call STOQ API directly

Confirmed by STOQ support — custom headers (X-Auth-Token), external endpoints, and JSON payloads fully supported.

CONFIRMED

Shopify metafield mirror of the limit is strictly read-only

Writing directly to the metafield does not enforce checkout caps — only STOQ's own PATCH endpoint updates the real limit.

CONFIRMED

Metafield trigger & definition created in Shopify

Definition ID: gid://shopify/MetafieldDefinition/214024749169 (backorder.incoming_po_quantity, type number_integer). Techsera writes incoming PO quantities via metafieldsSet, and the installed Workflow Trigger Extensions app detects changes to trigger Shopify Flow.

OPEN ITEM

Scenario 4: Outstanding PO Query on Stockout (Under Investigation)

Resolving event-ordering conflicts (Case A: early arrival inflation vs Case B: early stockout lockout). Can Techsera/Movex query outstanding (registered-but-not-yet-received) PO quantity per variant on demand when stock hits 0?

OPEN ITEM

Fulfillment-hold release flow testing

Flow designed but hit editor bugs during initial setup. Requires a clean rebuild and verification pass before production go-live.

NOTE

Capacity consideration: Workflow Trigger Extensions Free Tier

The Free plan includes a ceiling of 5,000 trigger events / month. Not an immediate blocker for launch, but an operational metric to monitor as catalog updates and PO volume scale.

Slide Deck Overview