# Stock and locations

> Keep stock per variant at each warehouse or shop, choose what can sell when it runs out, see how checkout holds stock, and link locations to MAM branches.

Source: https://docs.bifrostorbit.com/commerce/everyone/stock-and-locations/

Commerce Orbit counts stock for each variant at each of your locations: warehouses, shops or anywhere else you keep goods. Shoppers see what is available across all of them together.

## Locations

Open **Locations** to see where you keep stock. Commerce Orbit starts with one, **Warehouse**, as your default location. Admins can add, change and remove locations. Each has:

- **Name**, such as Oslo warehouse, and a short **code**, such as `OSL`, in capital letters, numbers and hyphens. Each code is used once.
- **Address**, shown to shoppers who collect
- **Collection in store:** when on, shoppers can choose to pick up their order here for free. See [Shipping and taxes](https://docs.bifrostorbit.com/commerce/everyone/shipping-and-taxes/).
- **MAM branch**, such as `BGN`, when you use MAM. See below.
- **Default:** the location returned stock goes back to. There is always exactly one.

The default location can't be removed; make another one the default first. A location that still has stock can't be removed either: move the stock first.

## Stock on a product

On a product, each variant shows its stock at every location. Editors and Admins can type a new number to set it, for example after a stock count. Setting stock tells CMS Orbit, so website pages showing the product update.

Two switches on each variant decide what happens when stock runs out:

| Setting | What shoppers see |
| --- | --- |
| **Track stock** off | Always available. No count is kept or shown. |
| **Track stock** on, **Sell when out of stock** off | Sold out when nothing is left. A cart with more than is left says how many are left, and checkout stops until the shopper changes it. |
| **Track stock** on, **Sell when out of stock** on | Always available. Stock can go below zero, so you can see how many to order in. |

What a shopper can buy is the total of all locations. A location with stock below zero counts as zero.

## How checkout uses stock

Stock is taken when the shopper starts to pay, not when they put something in the cart, so a full cart never blocks anyone else. It comes from the location with the most of that variant.

- If a card payment isn't finished within the time under **Hold stock for** in [Shop settings](https://docs.bifrostorbit.com/commerce/everyone/shop-settings/), 15 minutes unless you change it, the order is cancelled and the stock comes back.
- If the shopper changes the cart before paying and checks out again, the first unpaid order is cancelled and its stock comes back.
- Orders on invoice take stock straight away, as they are placed at once.

Cancelling an order puts its stock back unless you choose not to. A refund can put the refunded items back too. Returned stock goes to the default location. See [Refunds and cancellations](https://docs.bifrostorbit.com/commerce/everyone/refunds-and-cancellations/).

## Low stock

When an order takes a variant from more than 3 down to 3 or fewer, Admins and Editors get a **Low stock** notification. **Overview** lists active products with 3 or fewer left, and **Products** can filter by **Low stock** and **Out of stock**. See [Notifications](https://docs.bifrostorbit.com/commerce/everyone/notifications/).

## Stock from MAM

When MAM is on, it is the source of stock for every product with a MAM part number. Commerce Orbit asks MAM every 15 minutes, unless you chose another interval, and writes the answer over the stock you see:

- A location with a **MAM branch** gets MAM's stock for that branch.
- If no location has a branch, MAM's total stock goes to your default location.
- MAM can report stock below zero. Commerce Orbit keeps the number as MAM gives it and treats it as zero for shoppers.

Changing the stock of a MAM product by hand lasts only until the next sync. Products without a part number keep the stock you set. Shoppers always see the last synced stock, so a slow or unreachable MAM never holds up your shop. See [The MAM integration](https://docs.bifrostorbit.com/commerce/everyone/mam-integration/).

## Not there yet

Stock transfers between locations, purchase orders and a history of stock changes aren't part of Commerce Orbit yet.
