docs
/
AI skills

Stock levels — adjust, count, receive and move stock

Stock kept per product, size and location in Inventory. Opening stock, adjustments and counts, vendor deliveries received, transfers between locations, low-stock alerts. How orders hold and take stock, when the shop refuses to oversell, and what the site shows when something is out of stock.

Stock lives in Inventory, as one row (sf_inventory) per SKU per business location. A size or colour has a SKU of its own, so it has rows of its own. Each row holds three numbers:

FieldMeaning
quantityon hand, including units held for something
reservedQuantityheld, today only by a transfer waiting to leave
availableQuantityquantity − reservedQuantity, what can still be sold or moved

Nothing writes these numbers directly. Every change is a movement: opening stock, an adjustment, a count, a delivery, a sale, a transfer, a return. Each movement is saved with who made it, the quantity before and after, and the reason. After every movement, the server copies the totals onto the product: data.stock and data.locationStock on the product, and on each variation. The product editor then shows the stock as read-only, "kept by Inventory".

A product that has no Inventory row for any of its SKUs keeps its own number instead: the stock typed in the product editor, counted down when an order is placed. Pick one way per product. As soon as one of its SKUs gets a stock row, Inventory owns the product's figures.

The shop only refuses to oversell on a site that serves regions. The server checks a cart against stock only when the site names its stores (Site Config › Storefront › Regions this site serves, see Business locations, hours and sales tax). On any other site a shopper can put 50 in the cart when 9 are on the shelf, and the order goes through. Tested: a cart of 50 was accepted with 9 on hand, on a site with no regions. The built-in product page does stop at OUT OF STOCK when the stock reaches 0, but a custom page or a direct call does not.

Ask first

  • Which locations hold stock? Warehouse, each store. Each must exist in Business locations first.
  • Which products are tracked, and in what sizes? The product's own SKU, or each size's SKU. Ask for SKUs, not names.
  • How many of each, where, and what each unit cost. The unit cost matters: see step 3. 0 is allowed; "unknown" is not.
  • Reorder points: the level at which it should show as low, and how many to reorder.
  • For a delivery: the vendor, the location it arrived at, each SKU with quantity and unit cost.
  • For a transfer: from where, to where, what and how many.

Steps

1. Business locations: where stock is kept

Every stock row names its location by the location's name (its ID, the lowercase slug such as main-warehouse), never its title. Read the locations first with repo_find on location, or open Business locations (/business-locations). If one is missing, add it: see Business locations, hours and sales tax.

Opening stock does not check the SKU or the location. POST storefront/inventory saved a row for a SKU no product has, at a location that doesn't exist. Tested. Such a row counts in Inventory's totals and never reaches a product or a shop. Always take the SKU from the product and the location's name from its record.

Hands on: each location's name. Check: the location opens in Business locations under that ID.

2. Products: track the product and its sizes

A sale takes stock out only when the product is tracked. The product editor's switch Track inventory for this product (Products › Inventory section) saves data.available: true. The server also reads data.trackInventory, and when that is set (true or false) it wins over the switch. Products made through the API or an import can carry trackInventory: false, and then the switch does nothing. Read both before saying a product is tracked.

Sizes are rows of their own, keyed by the variation's sku (see Product with variants). A size with no row anywhere yet still draws on its product's row, which is how older stores kept every size in one row. The first time a size gets its own stock, it keeps its own from then on.

Hands on: the SKUs to stock (the product's, or each size's). Check: repo_find_one on sf_product: data.available is true (or data.trackInventory is true), and each variation has its sku.

3. Inventory: opening stock

On screen: Inventory (/inventory?tab=inventory) › Opening stock. Choose a product or size, a location and the quantity, and optionally a reorder point. The screen fills the unit cost from the product's cost (0 when it has none). Real action: call_appengine POST storefront/inventory:

{ "sku": "tee-m", "locationId": "main-warehouse", "quantity": 40, "unitCost": 6.5,
  "reorderPoint": 10, "reorderQuantity": 30, "productName": "Tee — M", "locationName": "Main warehouse" }

It returns the row. The first call for a SKU at a location opens the row, recorded as Opening stock. Sending the same SKU and location again changes the row instead:

  • with quantity, it is a count to that number (step 4);
  • without quantity, only the other fields change: reorderPoint, reorderQuantity, unitCost, productName, supplier… Use this to set a reorder point later. Tested: the reorder point changed and the quantity stayed.

quantity, reservedQuantity, unitCost and reorderPoint must be zero or more.

Always set unitCost, even 0. A web order takes its units out of stock only from a row with a unit cost (0 counts). Without one, the units stay on the shelf and the order shows "Stock needs attention" until a cost is set and someone presses Retry stock. The Studio form always sends one. A row opened by the API without unitCost, or by a transfer from a row that cost 0, has none.

When unitCost is above 0, opening stock also posts its value to Books (Inventory against the opening-balance account). So does every later adjustment, count and transfer. With a cost of 0, nothing is posted.

Hands on: each row, by SKU and location. Check: GET storefront/inventory/sku/<sku> lists the row with totalQuantity and totalAvailable. The product (/product?openId=<sk>) shows the total in its Inventory section, with the stock per location under it.

4. Inventory: adjust or count

On screen: the row's ⋮ › Adjust Stock or Record Count, or Stock Count at the top of the Inventory tab.

Adjust is a change, plus or minus: POST storefront/inventory/adjust

{ "sku": "tee-m", "locationId": "main-warehouse", "adjustment": -3, "reason": "Damaged: dropped in the stockroom",
  "idempotencyKey": "<a new key per entry>" }
  • The screen's reasons are Damaged, Lost or stolen, Found, Count correction, Returned to supplier and Other (a note is required for Other). The server doesn't check the reason, so always send one in that form: "<reason>: <note>".
  • A change that would take quantity below 0 is refused: "Insufficient inventory for tee-m at Main warehouse".
  • A SKU with no row at that location is refused: "Inventory not found for tee-m at Main warehouse". Open the row first (step 3).
  • idempotencyKey. If the answer never came back, send the same body with the same key: it is applied once, and the answer says alreadyApplied: true. The same key with a different change is refused (409 "Stock operation key already belongs to a different movement"). Tested.

Count sets the shelf total: POST storefront/inventory/count with { sku, locationId, countedQuantity, notes?, idempotencyKey? }. It answers with variance (counted minus what was on file) and stamps lastCountDate. Units held for a transfer stay held. Tested: a count of 3 against 6 on file answered variance: -3.

Hands on: the movement's transactionId. Check: the row's History (/inventory?openId=<row sk>), or GET storefront/inventory/sku/<sku>/transactions?locationId=<name>. Each movement has its type (intake, adjustment, count, sale, reserve, release, transfer_out, transfer_in, return), previousQuantity → newQuantity, the reason and performedBy.

5. Inventory › Intakes: receive a vendor delivery

An intake is a delivery from a vendor to one location. It is saved first as pending, and the stock goes in when it is received.

On screen: Inventory › Intakes (/inventory?tab=intakes). Real action: create with POST storefront/inventory/intakes:

{ "vendorId": "<bm_vendor sk>", "locationId": "main-warehouse",
  "items": [{ "sku": "tee-m", "quantity": 24, "unitCost": 6.25 }],
  "reference": "Vendor invoice 1182", "expectedDate": "2026-11-02", "notes": "" }
  • vendorId must be a vendor on file (bm_vendor, GET business-made/vendors; in Business Made it opens from Storefront › Inventory's purchase orders tab). Otherwise send vendorName as text.
  • The location must exist ("Choose a saved business location."). Each SKU must be a product's or a size's ("No product with SKU …"). A SKU may appear once ("… is listed twice"). Quantities must be above 0.
  • A delivery against a purchase order is not made here: it is received from the order (the Intakes tab's Receive against a purchase order), and this call refuses a purchaseOrderId.

Stop: receiving an intake with a unit cost above 0 creates an approved vendor bill in Books for what is owed (Inventory against Accounts payable), due on the vendor's terms (30 days by default). Show the vendor, the lines and the total, and wait for yes.

Receive with PUT storefront/inventory/intakes/<sk or intake number>/receive. Each line goes in as an intake movement. A row new to that location is opened for it. The row's unit cost becomes the weighted average of what it held and what arrived, and lastRestockDate is stamped. Receiving again changes nothing. A pending intake is cancelled with PUT …/cancel and { "reason": "…" }. A reason is required.

A delivery with no unit cost adds the stock and owes nothing. The intake then says "No unit cost on this delivery: stock was added, nothing is owed in Books." Tested.

Hands on: the intake number (INT-…) and, if made, its bill number (B-INT-…). Check: the intake shows received. Each row shows the new quantity, and its history shows "Received from on intake INT-…".

6. Inventory › Transfers: move stock between locations

On screen: Inventory › Transfers (/inventory?tab=transfers).

  1. Create: POST storefront/inventory/transfers with { fromLocationId, fromLocationName?, toLocationId, toLocationName?, items: [{ sku, quantity }], notes? }. Every item needs that much available at the source, or the call fails ("Insufficient inventory for at source location"). The units are reserved at the source: quantity stays the same, and availableQuantity goes down. Status pending, id TRF-….
  2. Ship: PUT …/transfers/<TRF-id>/ship with { trackingNumber, carrier }. The units leave the source. Status in_transit.
  3. Receive: PUT …/transfers/<TRF-id>/receive with { receivedItems: [{ sku, receivedQuantity }] }. What arrived goes into the destination, which opens a row when it has none. Status completed.
  4. Cancel: PUT …/transfers/<TRF-id>/cancel with { reason }. Only while pending. It releases the reservation.

A transfer can't be received before it ships, or cancelled after it ships. Tested.

A short receipt loses the difference. Units sent but not received don't go back to the source. Tested: 2 sent and 1 received left 1 unit in neither place. With a unit cost, the books record the shortfall as shrinkage. Ask before entering less than was sent.

Hands on: the transfer id. Check: GET storefront/inventory/transfers/<TRF-id> shows the status. Both rows' histories show transfer_out and transfer_in.

7. Inventory › Alerts: what is running low

A row is low when its reorder point is above 0 and availableQuantity is at or below it.

  • GET storefront/inventory/alerts/low-stock?locationId=<name> lists the low rows. Leave out the location to cover every location.
  • GET storefront/inventory/stats?locationId=<name> gives totalSkus, totalQuantity, totalValue (quantity × unit cost), lowStockCount and outOfStockCount.

On screen: Inventory › Alerts (/inventory?tab=alerts). Reorder on an alert makes a draft vendor bill for the reorder quantity (or back up to twice the reorder point). Nothing is posted until someone approves it in Books › Payable (see Enter a vendor bill). In Business Made, it starts a purchase order instead. Receiving an intake for those goods later folds that draft in, so the goods are owed once.

Nobody is told when stock runs low: there is no email or notice. Stock rows are written straight to the database, so an automation on sf_inventory or sf_product "updated" doesn't fire on a movement. Check the alerts on a schedule if the owner wants a heads-up.

Check: the Alerts tab lists the same rows.

How orders use stock

What happensStock kept in InventoryProduct keeping its own number
Cart and checkoutchecked against stock only on a site that serves regions (below)not checked by the server
Order placed (web checkout, staff order)nothing moves; nothing is reserveddata.stock (or the size's stock) counted down, never below 0
Order shipped (Ship in one click, manual tracking, Mark shipped)the shipped units leave stock as a sale—
Order completed (delivered → completed, or picked up in person)whatever has not left yet leaves—
Order made from an invoiceleaves when the order ships or completes, as abovenot counted down
POS tableaves when the tab is settled; a stock problem never fails the payment—
Cancel, refund, returnnothing goes back by itself: see Refund, cancel or return an order—

Only tracked products move (step 2). A bundle takes its parts out of stock, not its own SKU.

Which location an order draws from: the order's businessLocationId, when that location stocks the SKU. Otherwise the only location that stocks it. A web order gets a location only on a site that serves regions. So on a site with no regions, a SKU stocked at two locations can't be drawn. The order shows Stock needs attention: "no single stock location holds this SKU; set the order location". Fix it on the order (choose the location, then Retry stock), or with POST storefront/order/stock-retry/<orderNumber> and { "locationId": "<name>" }. The location can be changed only before anything has been drawn.

Other reasons for Stock needs attention: "Set a non-negative unit cost on inventory for at , then retry stock" (step 3), "no location stocks this SKU yet; receive stock for it, then Retry stock", and "Insufficient inventory …" (more shipped than on hand). The order still ships. Fix the cause, then Retry stock. It takes only what has shipped, never a unit twice.

On a site that serves regions

The site's regions are its stores (Site Config › Storefront). Each request is served for one store: the one the shopper picked, else the one matching the shipping address. Then:

  • product reads show each product's and size's stock at that store, less what is reserved. Tested: 6 at the store and 5 at the warehouse; the store's shopper saw 6.
  • adding to the cart, or adding more, beyond that store's stock is refused with 400 NOT_ENOUGH_STOCK_HERE: "Only 5 of Tee — M left in Main store." or "… is out of stock in Main store." Tested. Lowering or removing a line is never refused.
  • the card payment and the order are refused the same way ("… Nothing was charged."). A card already taken goes back.
  • the order is filed under that store (businessLocationId), so its stock comes from there.

This covers only tracked products with stock in Inventory, not bundles.

What the site shows

The built-in product pages (/store/<product>) read the product's stock (or the chosen size's):

StockProduct pageCard in the list
no number at allIn Stock, can be boughtcan be bought
0 or lessOut of Stock banner, button OUT OF STOCK (disabled)Sold out, button disabled
1 to 5Low Stock (n left)Only n left
above 5In Stock (n available)—

Before a size is chosen, a product whose sizes have stock shows the sizes' total.

  • "Available" on the site is the shelf count, reservations included, unless the site serves regions. Tested: with 3 of 9 held for a transfer, the page still said "11 available".
  • The site ignores Track inventory. A product switched off with stock: 0 still shows Out of Stock and can't be added. Tested. Clear the product's stock number, or give it one, rather than leaving 0 on an untracked product.
  • "Low stock" on the site is a fixed 5, not the reorder point.
  • On a custom page, data.stock is the same figure. window.appmint.cart doesn't check stock, so the page must hide or disable its own button.

When something goes wrong

What it saysWhyFix
Inventory not found for <sku> at <location>no row for that SKU thereopen it (step 3) or check the SKU / location name
Insufficient inventory for <sku> at <location>the change would go below 0, or a transfer wants more than is availablecount first, or move less
Inventory already exists for this SKU and location; use Stock Count or Adjust Stocktwo writes opened the same row at onceadjust or count it
Stock operation key already belongs to a different movementan idempotencyKey reused for another changea new key per entry
Inventory changed repeatedly; read the current quantity and retrymany changes at onceread the row, then send again
Choose the vendor the stock came from. / Choose a saved business location. / No product with SKU …intake fieldsstep 5
Transfer is not in transit / Only pending transfers can be cancelledwrong order of stepsship before receiving; cancel before shipping
Order: Stock needs attentionno unit cost, no single location, nothing in stock theresee How orders use stock, then Retry stock
NOT_ENOUGH_STOCK_HERE at the cart or paymentregion site, more than that store holdslower the quantity, or receive or transfer stock in
The product's stock doesn't match what was typed in the editorthe product has stock in Inventory, which owns the figurechange it in Inventory

When it's done

Tell the person:

  • each SKU at each location: on hand, held, available, its reorder point and unit cost;
  • each movement made, with its reason (an adjustment of −3, "Damaged");
  • deliveries received (intake number, and the bill if one was made), transfers and their status;
  • whether this site refuses to oversell (only if it serves regions), and anything an order still owes.

Open Inventory on the Inventory tab, with the row's history.

What it can't do yet

  • No stock check without regions. Carts and orders on a site that serves no stores are never checked against stock. There is no "allow backorders" switch and no "deny" switch: the only control is regions.
  • Web orders don't reserve stock. Units leave at shipping. Until then, two orders can both count on the same last unit. Only transfers reserve.
  • POST storefront/inventory/reserve, /release and /fulfill exist, but nothing in the order flow calls them. Don't use them on an order: shipping takes the stock again, and the units come off twice.
  • No low-stock notification and no automation trigger on stock movements.
  • No serial numbers, lots or expiry dates. The row has a place for them (tracking), but nothing reads it.
  • The Inventory list's "Low Stock" badge compares on-hand to the reorder point, while Alerts uses available. A row with units held for a transfer can be in Alerts and show "In Stock" in the list.
  • GET storefront/inventory/location/<name>?lowStock=true filters only the page it read, so its total is the location's whole count. It also lists out-of-stock rows with no reorder point. Use the Alerts call.

Don'ts

  • Don't write quantity on a stock row with repo_update or Inventory › Manage. Tested: the quantity changed, availableQuantity didn't, no movement was recorded, and the product never heard of it. Use adjust or count.
  • Don't open stock without a unit cost (step 3), and don't guess one: ask.
  • Don't adjust to "fix" an order that says Stock needs attention. Fix the cause and press Retry stock, or the units come off twice.
  • Don't receive an intake with costs, or press Reorder, without a yes: they owe a vendor money in Books.
  • Don't receive less than was sent on a transfer without asking.
  • Don't promise the shop won't oversell unless the site serves regions.