# Keep-assembled cascade

The assembly BOM's Keep assembled on return switch, the halt rule, and how it interacts with the parent bill's switch on cancel or refund.

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

When an order is cancelled or refunded, Assemblified walks the bill tree to decide what to restore where. The walk
respects a **Keep assembled on return** setting at every layer: both the parent finished good's bill and each
assembly BOM carry their own.

The rule that ties them together: **the walk halts at any node that is set to keep its units assembled.** This
page explains the halt rule with examples.

## On this page

- The switch, and where to find it
- The halt rule, and its three sources
- The three-branch table
- A worked example
- Logistified asymmetry

## The switch

Every assembly BOM has its own <Term def="keep-assembled-on-return">Keep assembled on return</Term> switch,
independent of the parent bill's. You find it on the assembly BOM page under **Settings → Preferences**, next to
*Only consume pre-assembled stock*. The two are saved together with the page's save bar.

- **On.** When the assembly is being restored on cancel or refund, the units stay assembled: they go onto the
  assembly's pre-assembled shelf rather than breaking back into materials.
- **Off.** The assembly's components are restored to stock, and nested assemblies inside it are evaluated by the
  same rule.
- **Default:** off.

You can flip it for many bills at once from the Assembly BOMs list: tick rows, then **Assembly settings → Keep
assembled on return → Enable / Disable**.

The same setting exists for a finished good's bill. See
[Refunds & cancellations](/features/bill-of-materials/refunds-cancellations/) for that side.

## The halt rule

When the parent bill's switch is **off** (so the walk is traversing), the cascade descends through nested
assembly BOMs. **At each assembly BOM**, the rule is:

- If the assembly keeps its units assembled: restore to that assembly's pre-assembled shelf, and **do not recurse
  further** into its components. The components stay inside the assembled units.
- Otherwise: recurse deeper. The assembly's components are restored normally.

Three different things make an assembly keep its units assembled, and they produce exactly the same halt:

1. **Keep assembled on return** is on for that bill.
2. **Only consume pre-assembled stock** is on for that bill. On the sale it consumed *only* its shelf, so there
   is nothing below to restore. The full quantity goes back to its shelf and the walk stops. See
   [Only consume pre-assembled](/features/sub-assemblies/only-consume-preassembled/).
3. **A per-location rule** in **Disabled** or **Pre-assembled only** mode covers the location the return is
   happening at. At that location the assembly behaved as a shelf on the way out, so it behaves as one on the way
   back. Every other location is untouched. See [Location rules](/features/bill-of-materials/location-rules/).

<Aside type="note" title="The two sides always match">
Whatever made the sale stop at an assembly makes the return stop at the same assembly. That is what keeps the
arithmetic honest: components that were never consumed are never restored.
</Aside>

## The three-branch table

For a finished good B containing assembly BOM S:

| Parent's switch | Assembly's switch | What restores on cancel or refund of N units |
|---|---|---|
| **On** | (any) | Nothing decomposes. The finished good's pre-assembled +N. |
| **Off** | **On** | S's pre-assembled +N × its reference quantity. S's components stay inside. B's *direct* materials return. |
| **Off** | **Off** | All materials return, both B's direct ones and S's nested ones. Recursion continues into deeper nested assemblies. |

## A worked example

Finished good B contains 3 × Raw R1 + 1 × Assembly BOM S.

S contains 5 × Raw R2 + 2 × Raw R3.

A customer orders 4 units of B, then cancels.

**Configuration A: B's switch on**

- B's pre-assembled gets +4.
- R1, R2, R3 all unchanged.
- S's pre-assembled unchanged.

**Configuration B: B off, S on**

- R1 +12 (4 units × 3 per unit).
- S's pre-assembled +4 (4 units × 1 per unit).
- R2, R3 unchanged.

**Configuration C: B off, S off**

- R1 +12.
- R2 +20 (4 × 1 × 5).
- R3 +8 (4 × 1 × 2).
- Pre-assembled unchanged at every level.

## Logistified asymmetry

If you have the Logistified integration, demand tracking always sees the **full** material requirement on
cancel or refund, regardless of the cascade. The reasoning: demand is in absolute terms. The order is not being
fulfilled, so the demand drops. Whether the physical components actually return is a separate question, and that
is what the cascade rule answers.

This is usually what you want. The asymmetry only matters when you reconcile reports across the two systems. See
[Refunds & cancellations](/features/bill-of-materials/refunds-cancellations/) for the finished-good side.

## Common gotchas

- **A deeper assembly's setting is only consulted if the walk can reach it.** A parent bill that keeps its units
  assembled stops everything; the settings below it are never read.
- **Changing the setting is not retroactive.** Cancellations already processed applied whichever branch was in
  force then. Flipping it now affects future cancellations only.
- **A restore can leave a shelf negative, and that is correct.** Nothing clamps at zero. If a cut-off sale had
  driven a shelf to −5, a +3 restore lands at −2. The negative is an honest record of a deficit; see
  [Pre-assembled stock → Negative shelves](/features/sub-assemblies/pre-assembled/#negative-shelves).

## Where to next

- [Refunds & cancellations](/features/bill-of-materials/refunds-cancellations/) — the parent side, with partial
  versus full refund netting.
- [Pre-assembled stock](/features/sub-assemblies/pre-assembled/) — where restored units land.
- [The assembly BOM page](/features/sub-assemblies/assembly-bill-page/) — where the switch lives.

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