# Operating materials & stock

What a connected AI assistant with write access can do with your materials — register from Shopify, create virtual materials, and set stock levels.

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

With **write access**, an assistant connected to Assemblified can build and maintain your <Term def="raw-material">materials</Term> — the components your BOMs and assembly BOMs are made from. It can register materials straight from your Shopify catalog, create purely internal <Term def="virtual-material">virtual materials</Term>, and keep their stock levels accurate. This page explains what that covers.

## On this page

- What it takes
- Registering materials from Shopify
- Creating virtual materials
- Editing and removing materials
- Setting virtual stock levels
- Doing it in bulk
- Safety & audit

## What it takes

Write access is opt-in. The assistant needs either an **API key created with read & write scope** or a **web-chat connection granted read & write** when it was linked. A read-only connection can check cost-and-price eligibility, but cannot apply changes. See [API keys](/features/agent-access/api-keys/) and [Connect claude.ai or ChatGPT](/features/agent-access/connect-web-chat/).

## Registering materials from Shopify

Most materials are real Shopify variants. The assistant can find them in your catalog (see [What the assistant can read](/features/agent-access/what-the-agent-can-read/)) and **register them as materials** — one at a time or many at once. Each registration reports whether the material was newly created or already existed and was refreshed, so re-running is safe.

## Creating virtual materials

For components that don't exist as Shopify products — internal parts, packaging, consumables — the assistant can create <Term def="virtual-material">virtual materials</Term>, whose stock Assemblified tracks itself. It can set the product and variant name, unit of measurement, SKU, and an opening stock quantity.

Assemblified keeps stock per location, so the opening stock is placed at your
[default location](/getting-started/initial-setup/#default-location) (your first Shopify
location when none is set). From then on the material's total is the sum of its locations and follows
on its own. Each new material and its opening stock are saved together after Assemblified checks your Shopify
locations. Creating a material again is a separate creation: if an assistant loses the result, ask
it to check your materials and opening stock before repeating the request. A warning about a
connected app after creation means the material is already saved in Assemblified.

Units of measurement always resolve against your store's unit catalogue (**Settings → Units**): familiar spellings map to the canonical unit (`KILOGRAMS` becomes `kg`), and a genuinely new unit is added to the catalog automatically as a custom unit — so every material's unit is one you can manage in Settings. Weight units are stricter: a material's physical weight must use one of your existing weight units, since conversions and BOM weight roll-ups depend on them.

## Editing and removing materials

The assistant can **update** a material's details and **delete** materials you no longer need.
Stock is not one of those details: a material's total is the sum of its locations, so it cannot be set
directly. A request to set it is refused with the advice to change stock at a location instead, as
described below. A material that's still used by a BOM or assembly BOM is protected — the delete fails for that item with a clear reason, so nothing in active use disappears silently.

## Setting virtual stock levels

For virtual materials, the assistant can keep per-location stock accurate:

- **Add or subtract** a quantity (a delta — "we received 200 more").
- **Set** an exact quantity (an absolute count — the safe choice for a stock-take, because repeating it can't double-count).

Shopify-linked materials keep their stock in Shopify — the assistant reads those live levels but doesn't change them here.

<Aside type="note">
    Real per-location levels for any mix of materials are available to read through the inventory surface, and your Shopify locations are
    readable so the assistant can resolve which location a level applies to. See [What the assistant can
    read](/features/agent-access/what-the-agent-can-read/).
</Aside>

## Restocking

Beyond virtual materials, the assistant can **restock any material at any location** — Shopify-linked
ones included. It states either a change ("add 200") or a target ("set it to 40"); a target is the
safe choice, because repeating it cannot double-count. Shopify-linked materials are written to
Shopify and mirrored back into Assemblified; virtual ones are written to Assemblified's own stock.

Every row is applied on its own: one line that cannot be written — a material that no longer exists,
a level that could not be read, or stock that your store group manages from the main store — is
reported with the reason and the rest still land. The same goes for two rows that change the same
Shopify-linked material at the same location in opposite directions (one adds, the other removes):
Shopify cannot report the outcome of each, so nothing is sent for that material at that location,
both rows fail with the advice to combine them into one row and apply again, and the other rows
still apply. There is a **preview mode** that plans the whole
run, refusals included, and writes nothing.

## Keeping materials in step with Shopify

- **Refresh from Shopify** re-reads the products behind a set of Shopify-linked materials and updates
  the details Assemblified mirrors — price, cost, image, vendor, type, category and weight. It pushes
  nothing to Shopify. Virtual materials are skipped, not failed.
- **Compare and reconcile** shows, per location, what Assemblified's own stock index says next to
  what Shopify reports, and can then fix the difference in either direction — only the locations that
  actually differ are written. Pushing the index's numbers to Shopify moves real stock, so read the
  comparison first. This pair only works when **Use local index** is switched on under
  **Settings → General**; with it off, both the comparison and the fix are refused with that reason
  rather than comparing against figures nothing maintains.

## Metafields

The assistant can read every stored metafield value for a material or a batch of materials. Before
changing an existing value, ask it to check the exact saved value, its definition and whether it
applies everywhere or at a particular location. A material can have different saved values for the
same definition at different locations. An empty result does not prove that the material exists.

With write access, it can submit **1–25 explicit add, update or reset requests** together:

- **Add** creates a value that applies everywhere. An existing value can prevent another add; adding
  does not automatically update it.
- **Update** changes the exact saved value you selected, including an existing value at a location.
  Leaving the value or note out preserves it; explicitly clearing it removes that content.
- **Reset** drops the local override and restores what Assemblified last received from Shopify.
  It uses that saved Shopify value, rather than fetching a fresh one, and keeps the saved copy.

These requests do not create a new value for a particular location, turn on an override or send
changes to Shopify. Values are checked against the definition's type and changes retain history.
Removing a value and re-reading Shopify values remain separate actions.

The assistant checks that every request is complete before any edit starts. Once editing begins, a material, definition
or value that cannot be changed fails on its own; later requests still run. Repeated requests count
toward the limit of 25 and run in the order submitted. The group is not saved or undone as one unit.
A success count describes returned requests, including values that were already equal; an error can
arrive after a value was saved, and work may continue after a timeout. **Do not repeat an uncertain
batch automatically.** Ask the assistant to read current values and history before deciding what to
do next. Those reads cannot prove which request saved a value.

## Doing it in bulk

The assistant can **create many** materials and **delete many** in single calls — registering a hundred Shopify variants, or creating a batch of virtual components, without hundreds of separate requests. These create and delete calls return a **per-item result** (created / skipped-as-duplicate / failed) and offer a **preview mode** that validates without writing, so a plan can be checked before it's committed.

It can also apply **one settings change to a whole selection** — vendor, product type, category, unit
or the non-essential flag — where the selection is either a list of materials or "everything matching
this search". A vendor change on a Shopify-linked material is refused for that row alone, because
Shopify owns it.

For **virtual materials**, the assistant can set the same **unit cost**, **selling price**, or both
on **1–100 explicitly selected materials** at a time. Zero is allowed; leaving a value out keeps it
unchanged. Values must be finite numbers of zero or more. This cannot be combined with a settings or
unit change, and it cannot target “everything matching this search”. Shopify-linked materials are
refused, even when the requested value is already stored, because Shopify owns their cost and price.

Ask for a **preview** first. It is advisory: it checks which materials currently exist and allow the
change, and saves nothing. It does not reserve those materials or promise that a later save, a
connected-app update or a parent BOM cost refresh will succeed. The assistant checks again when applying.
Read-only connections can preview; applying needs write access.

Each material is handled separately. A reported success can include a value that was already equal;
it does not prove a new change or that connected apps received it. An error can arrive after a value
was saved, and a connected-app error can leave parent BOM costs awaiting refresh. If the outcome is
unknown, ask the assistant to read the material values and check connected apps and parent costs before
continuing. **Do not repeat an uncertain batch automatically.** Reading the current values cannot prove
which request saved them.

Before a bulk delete there is a **preview**: per material, what is in the way (the BOMs still using
it, named), what would be removed with it, and what is worth knowing first (stock on hand, live
reservations, stored metafield values). The preview is advisory and incomplete; the assistant checks
blockers again when deleting. Its adjustment-history count shows currently stored older movement
entries that are kept when the material is deleted. It is neither a count of entries to be deleted
nor a quantity or a total of all movement history; zero does not mean there is no history. Keep the
material's original identifier if you need to ask the assistant for its locally available movement
history afterwards. Older archived entries are not available through the assistant, and this does
not preserve metafield-value history or promise that a deleted material's detail page will open.

<Aside type="tip">
    See [Build and stock BOMs from your catalog via the API](/guides/build-boms-via-api/) for the end-to-end flow that ties material
    registration together with building BOMs.
</Aside>

## Safety & audit

Every call the assistant makes is tied to the API key or connection it used, and access can be revoked at any time — see [Managing access & security](/features/agent-access/managing-and-security/). Write access is scoped to your single store, and a connection can never reach anything beyond the scope its key or connection was granted — but that scope covers more than this page: see the [operating pages index](/features/agent-access/overview/#the-operating-pages) for every write surface a write key unlocks.

## See also

- [Operating BOMs & assembly BOMs](/features/agent-access/operating-boms-and-assemblies/) — building and composing finished goods.
- [What the assistant can read](/features/agent-access/what-the-agent-can-read/) — the read surface.

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