> ## Documentation Index
> Fetch the complete documentation index at: https://www.twicecommerce.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# How to add a stock code

> Add a code to a stock item that already exists, or replace one, on its General tab, so a scan of the code finds the unit.

> [card] [Open in TWICE Admin](https://admin.twicecommerce.com/inventory/stock-items)
>
> inventory/stock-items

Add a code to a stock item that already exists, such as a manufacturer's serial beside your own asset tag, or replace a worn label's code. A scan of any of its codes finds the unit. [Stock codes](https://www.twicecommerce.com/docs/concepts/inventory/stock-codes.md#multiple-codes-per-item) explains how one unit answers to several codes.

## Prerequisites

> [!WARNING]
>
> **Required permissions:**
>
> * **Create and edit stock items** to change a stock item's codes (`inventory:stock_item:manage`). Every built-in role holds it, Member included.
>
> See [Users & Roles](https://www.twicecommerce.com/docs/settings/users-roles.md).

> [!NOTE]
>
> **Have ready before you start:**
>
> * **The new code**, typed or on a label you can scan. No other stock item in your account may carry it. See [Stock codes](https://www.twicecommerce.com/docs/concepts/inventory/stock-codes.md#uniqueness-scope).

## The walkthrough

**1. Open the stock item**

Open **Inventory → Stock items**. With more than one location, check the location selector in the top-left corner first, because the table lists only that location's stock. Type the item's name or one of its codes in the search box above the table, and click its row. The stock item opens on its **General** tab.

**2. Click into Item Code**

Find **Item Code** in the main card of the **General** tab, under **Item Name**. Each code the unit answers to is a grey chip in the field. Click in the field after the last chip.

**3. Add the new code**

Type the new code and press Enter, or scan its label while the cursor is in the field. The code becomes a chip beside the others. **Validating codes…** shows under the field while the code is checked against your other stock items, and a bar with **Save changes** appears across the top of the page.

**4. Remove a red chip**

Wait for **Validating codes…** to clear. A red chip is a code another stock item already carries, or one listed twice, and the line under the field counts it. Click the cross on a red chip to remove it, because a code in use elsewhere cannot be saved.

**5. Remove a code you are replacing**

Skip this step to keep every code. To retire an old code, click the cross on its chip. The unit stops answering to it once you save, and the code is free for another stock item.

**6. Save the change**

Click **Save changes** in the bar across the top of the page. The bar closes and the chips stay as you left them. **Discard** in the same bar undoes every change since the last save.

## How do I know it worked?

* **The new chip is in Item Code** when you reload the stock item.
* **A scan of the new code finds the unit.** From any page except an order, the scan adds the unit to the **Scanned items** drawer.
* **A code you removed finds nothing** when scanned, unless another stock item has taken it since.

## Troubleshooting / common pitfalls

> [accordion] Scanning the label added nothing to the field
>
> The field reads a scan only while the cursor is in it. Anywhere else on the page, the scan looks the code up instead. Click in **Item Code** and scan again. See [Stock codes](https://www.twicecommerce.com/docs/concepts/inventory/stock-codes.md#qr-codes-and-barcode-scanning).

> [accordion] A chip turns red
>
> Another stock item already carries the code, or it is listed twice on this one. Codes are unique across your whole account, so remove the chip, or take the code off the other stock item first. See [Stock codes](https://www.twicecommerce.com/docs/concepts/inventory/stock-codes.md#uniqueness-scope).

> [accordion] The new code does not scan
>
> A scan matches a code exactly, character for character, once spaces at either end are trimmed. Compare the printed label with the chip, and check that the scanner adds no prefix or suffix. See [Stock codes](https://www.twicecommerce.com/docs/concepts/inventory/stock-codes.md#faqs).

## Related articles

> [card] [Stock codes](https://www.twicecommerce.com/docs/concepts/inventory/stock-codes.md)
>
> How one unit answers to several codes, and what a scan of each kind of code does.

> [card] [Scanning and editing stock](https://www.twicecommerce.com/docs/guides/inventory/stock-codes-and-barcodes)
>
> Every walkthrough for scanning stock items and changing them in bulk.

> [card] [Scan stock items](https://www.twicecommerce.com/docs/guides/inventory/scan-stock-items.md)
>
> Collect units by their codes and act on the pile.

> [card] [Register stock items](https://www.twicecommerce.com/docs/guides/inventory/register-stock-items.md)
>
> Set the codes when you add new units.

> [card] [Stock item General tab](https://www.twicecommerce.com/docs/inventory/stock-items/general.md)
>
> The fields on the General tab, Item Code among them.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.