# Execution model

What happens when a Shopify order arrives — webhook to inventory adjustment to audit log.

import Term from '~/components/Term.astro';
import { Steps } from '@astrojs/starlight/components';
import DocUpdated from '~/components/DocUpdated.astro';

An Assemblified BOM **executes** when a Shopify order containing the finished-good variant is created (or cancelled, refunded, edited). The pipeline runs in milliseconds; the audit log captures every step. This page explains the model end-to-end so you can predict — and debug — what happens for any given order.

## On this page

- The execution pipeline at a glance
- The order of operations inside Assemblified
- Pre-fulfillment vs post-fulfillment timing
- Multi-location behavior
- The logs page — where to find a run, and what it shows
- Common failure modes

## The pipeline at a glance

<Steps>

1. **Customer places an order** in your Shopify storefront.
2. **Shopify fires a webhook** to Assemblified.
3. **Assemblified disambiguates** the event — is it a create, a cancel, a refund, or an edit?
4. **The work is enqueued.** A background job buffers the order so it can be retried if anything goes wrong.
5. **Assemblified processes the order.** It walks the BOM's component structure and computes inventory deltas, drawing from <Term def="pre-assembled">pre-assembled stock</Term> first.
6. **Shopify gets the inventory adjustments.** Component variants are decremented; if you have <Term def="dynamic-adjustment">dynamic adjustment</Term> on, the BOM's displayed quantity is recalculated.
7. **An <Term def="bom-execution-log">execution log</Term> entry is written.** This is your audit trail, and it appears on the **Logs** page.

</Steps>

The whole pipeline typically takes 1–5 seconds for a simple BOM and a few seconds longer for BOMs with deep assembly BOM nesting or many locations.

## The order of operations

When Assemblified processes an order, materials are sourced in a specific order. This matters because it affects what gets decremented:

<Steps>

1. **Pre-assembled stock first.** If the BOM has <Term def="pre-assembled">pre-assembled stock</Term>, that's consumed before anything else. Order quantity 8, pre-assembled 5 → 5 come off the shelf, 3 still need to be sourced.

2. **Assembly BOMs next.** For each remaining unit, expand the BOM's assembly BOM references (definitions for subassemblies). Each one has its own pre-assembled shelf — that's consumed before falling through to its components.

3. **Materials last.** Whatever remains after the shelves are exhausted pulls from material inventory. <Term def="raw-material">Shopify-linked materials</Term> are decremented through Shopify. <Term def="virtual-material">Virtual materials</Term> are decremented inside Assemblified's own inventory (no Shopify call).

4. **Dynamic adjustment cascade.** If any BOM in the order (or any other BOM that shares components with it) has dynamic adjustment on, Assemblified recomputes the displayed Shopify quantity for those BOMs from current availability.

5. **Maintain inventory level.** If the BOM has <Term def="maintain-same-inventory-level">Maintain inventory level</Term> on, a positive delta equal to what Shopify just decremented is pushed back, keeping the displayed quantity flat.

6. **Auto-generate material list.** If on, a new order creates a draft **Material list only** work order with the material list, plus a task that links to it, for the operator to pick from or download. No stock moves from this step.

7. **Log the result.** All of the above becomes one run on the **Logs** page.

</Steps>

## Pre-fulfillment vs post-fulfillment

Assemblified subscribes to twelve Shopify webhook topics. Two groups matter for timing:

- **`orders/updated`** fires on order create, edit, cancel and refund. On a single-location store this
  is what drives execution, so the inventory adjustment happens at order time — *before* you've
  fulfilled anything.
- **Five `fulfillment_orders/*` topics** (routing complete, placed on hold, hold released, moved,
  cancelled) drive the routing-time path on multi-location stores, together with the
  `fulfillments/*` topics.

Which of the two you get is a **store setting**, not a per-BOM one:
**Settings → General → Multi-location sensitive adjustments**.

- **Track BOM materials as Shopify-reserved between routing and fulfillment — on.** When the order
  routes, the components move from available to reserved at the routed location, and fulfillment
  consumes them. The storefront number drops at routing. Units an order edit adds are reserved at the
  edit and consumed when they ship.
- **Off (deduct at fulfillment).** Routing records the intent and moves no stock; each fulfillment
  deducts available stock **at its own location**, so split orders and partial shipments reduce at
  the correct place. Units an order edit adds are recorded at the edit and deducted when they ship.

Both are described in full on [Order reservations](/features/bill-of-materials/order-reservations/).

## Multi-location behavior

Assemblified resolves the location for each component in this priority:

1. **A [location rule](/features/bill-of-materials/location-rules/) at the fulfilling location.** A
   rule can rewrite the BOM there — change a quantity, drop a material, add one the base bill
   doesn't carry, or draw a component from a different location — and it can switch the bill off at
   that location entirely, in which case the line consumes nothing at all.
2. **The component's own pinned location**, if the BOM pins that material to one warehouse.
3. **The order's location**, if your store has *Respect order and fulfillment locations when
   available* on in Settings → General.
4. **The store's default Shopify location.**

So if you have multi-location inventory:

- Set per-component locations on the BOM detail page when a specific material always comes from one warehouse.
- Leave them blank to let the order's location drive the choice (with the store-level setting on).
- Use the **Locations** tab on the finished good to make one location behave differently. That tab
  only appears once multi-location sensitive adjustments are on.

## The logs page

Every run — an order, a flow, a manual adjustment, an automatic adjustment — appears on **Logs** in
the main navigation. The list carries:

- a **Type** switcher: All · Orders · Flows · Manual adjustments · Automatic adjustments · Other,
- an **Outcome** filter: Succeeded · Pending · Failed · Skipped,
- a search box that takes an order number or a flow name (three characters or more),
- columns for Outcome, Type, Subject, Bills, Location and Date.

A skipped run is not a failure — a duplicate delivery, a switched-off feature or a line with no bill
are all decisions the app took on purpose — so it is badged neutrally rather than as an error.

An order that carries a tag from **Settings → General → Ignored order tags** when Assemblified first
receives it never enters the pipeline above. It gets one run with the outcome **Skipped**, and its
warning names the tag. Assemblified then ignores the order for good, including its later fulfillments,
cancellations and refunds. See [Ignored orders](/features/settings/general/#ignored-orders).

Open a row for the run's own page:

- **Summary** — outcome, type, trigger, date, duration, location, the order it belongs to, and how
  many times it was retried.
- **Ordered** (or **Produced** for a flow, **Adjusted** for an adjustment) — the lines that were
  processed, how many bills were processed and how many were skipped, each skipped one with its
  reason.
- **Material changes** — every material, its SKU, its location and the calculated change, with a
  badge saying how far the Shopify write got. A second badge covers the Logistified leg when that
  integration is connected.
- **Pre-assembled changes** — what came off (and back onto) the shelf per item and location, with
  before-and-after counts, and any shortfalls.
- **Errors** or **Warnings** — what went wrong and which stage it came out of (webhook, queue,
  execution, bills, inventory sync, adjustment), with the technical detail behind a disclosure.

Two more tools sit in the list's ⋯ menu: **Check missing orders**, which looks for orders that never
produced a run, and **Check duplicates**.

If a BOM didn't seem to fire, look at **Bills skipped** in the run's Summary. The most common causes
are an inactive bill, a bill a location rule disabled at that location, or a webhook that never
arrived — which produces no run at all rather than a skipped one.

## Common failure modes

| Symptom | Likely cause |
|---|---|
| Order placed, no run appears on Logs | The webhook never arrived. Use **Check missing orders** on the Logs page; reinstalling the app re-registers the subscriptions. |
| The run lists the bill under **Bills skipped** | The bill is inactive, or a location rule disables it at the fulfilling location. |
| The order has one **Skipped** run and nothing else happens for it | The order carries a tag listed under [Ignored order tags](/features/settings/general/#ignored-orders). The run's warning names the tag. |
| Components didn't decrement, the run succeeded | The pre-assembled shelf absorbed it. **Pre-assembled changes** on the run shows what came off. |
| Shopify shows the wrong quantity after an order | Dynamic adjustment may be off for that bill, or the Shopify write failed — the run's **Material changes** badge says which. |
| Cancel didn't restore materials | Check **Keep assembled on return** — if on, the units stay assembled. See [Refunds & cancellations](/features/bill-of-materials/refunds-cancellations/). |
| Inventory went negative | Shopify allows negatives if your location settings permit. Lock it down at the store level, not the BOM level. |

## Where to next

- [Pre-assembled stock](/features/bill-of-materials/pre-assembled/) — the shelf and how it's drawn down.
- [Refunds & cancellations](/features/bill-of-materials/refunds-cancellations/) — what happens when an order goes the other way.
- [Dynamic adjustment](/features/bill-of-materials/dynamic-adjustment/) — the recompute formula.
- [Location rules](/features/bill-of-materials/location-rules/) — how one bill can run a different BOM, or nothing at all, at one location.
- [Order reservations](/features/bill-of-materials/order-reservations/) — reserve at routing, or deduct at fulfillment.
- [Historical orders replay](/features/bill-of-materials/historical-orders/) — replay past orders through this same pipeline (e.g. when a BOM didn't exist at the time).
- [BOM execution end-to-end guide](/guides/bom-execution-end-to-end/) — a worked example, beginning to end.

<DocUpdated date="2026-11-19" />