Shopify metafields for inventory: bin codes, lot numbers, and supplier refs per variant
Set up Shopify metafields for inventory — bin codes, lot numbers, and supplier refs per variant — plus when a spreadsheet still beats the fields.
InventoryX is in development and not available today. ClearStock is the live Shopify app.
Short answer: Shopify metafields are custom fields you attach to each product and variant — bin location, lot number, supplier reference, case pack size — and the free version of this is entirely native: Settings → Custom data, a few definitions, and the fields show up as columns on your product pages. For inventory operations at 100–5,000 SKUs, they're usually a better home for this data than a parallel spreadsheet, because the data travels with the variant instead of living in a file someone has to remember to update.
This is a click-path walkthrough: the actual screens, in order, for building three inventory metafields — bin code, lot/supplier batch, and supplier reference — plus the decision of what belongs in a metafield, what belongs in the SKU itself, and where spreadsheets still win.
What a metafield actually is
A metafield is a key-value pair attached to a Shopify resource, with a type (text, integer, date, JSON, reference) enforced by a definition you create first (Shopify dev docs, "About metafields," accessed October 2026). Three parts matter for inventory use:
- Namespace and key — the field's address, like
inventory.bin_code. The namespace groups related fields and prevents collisions with app-created fields. - Type — the definition validates what goes in. A "single line text field" bin code can't silently become a paragraph; an integer case-pack quantity can't become "usually 12."
- Owner — metafields attach to products, variants, orders, customers, and more. For inventory ops, the variant is the owner that matters: bin codes and supplier refs are per-variant (the 250g tin and the 500g tin live in different bins), not per-product.
Shopify also ships pre-built standard definitions for well-known fields like ISBN and care instructions — use them when they match, because other apps and Shopify's own search know how to read them.
The click-path: three inventory metafields, start to finish
The path below follows the Shopify admin as of October 2026 (Shopify Help Center, "Metafields" and "Adding metafield definitions," accessed October 2026).
Step 1 — Create the definitions. Go to Settings → Custom data → Products. Metafields for variants are managed from the Products page: choose Product variant as the definition type when prompted (or pick it from the definition options). Click Add definition.
- Name:
Bin code. Namespace and key:inventory.bin_code(type the namespace and key manually, or accept the generated one and edit it). Description: "Physical pick location, format A-03-2." - Select type: Single line text field. Under validation you can add rules — for bin codes, leave it open; for lot numbers, "single line text" is right too.
- Save. Repeat twice more:
Lot / supplier batch→inventory.lot— single line text.Supplier reference→inventory.supplier_ref— single line text (this holds the supplier's own item number, which is almost never your SKU).
Step 2 — Make the fields visible where you work. Metafields exist but are hidden by default. On any product page in the admin, click the variant, and the new fields appear in the variant editor's metafield section. Better: on the Products list page, click the column chooser (the columns icon at top right) and add Bin code, Lot, and Supplier reference as admin columns. Now your whole catalog shows bins in a scrollable grid — this is the moment most merchants realize the spreadsheet they kept for exactly this is redundant.
Step 3 — Backfill values. Three routes, worst to best:
- One by one, in the variant editor. Fine for 20 SKUs, miserable for 500.
- Bulk editor: select products in the list, click the ⋯ menu, choose Edit variants, add the metafield as a column, and fill values spreadsheet-style inside the admin (Shopify Help Center, "Using the bulk editor," accessed October 2026).
- CSV: product and variant metafields can be exported and imported through the standard product CSV. Export first, fill the metafield columns for your SKUs, import back. This is the route for the initial migration from a spreadsheet — the inventory CSV guide covers the mechanics and the overwrite traps.
Step 4 — Put the fields to work. With definitions in place, metafields become filterable in the admin: use the filters on the product list (or a saved view built on them) to pull every SKU in a pick zone. They're also exposed to Shopify Flow, so a "tag products whose supplier ref changed" automation is a few clicks.
A spice-shop example, concrete: 180 SKUs of tins, jars, and refills across three shelving units. The bin metafield holds S2-B04-3 (unit 2, bay 4, shelf 3); the lot metafield holds the packer's batch stamp (L2609C) so a recall question ("which lots of smoked paprika came in the October container?") is a filter, not an afternoon in email; the supplier ref holds the mill's item number so reordering means reading the number straight off the last PO instead of looking it up. None of that changes what Shopify charges you or which plan you're on.
Definition list vs metaobject: the caution
Two structures look similar and are not interchangeable:
- Metafield definitions — one field at a time, attached to a resource. Bin code, lot, supplier ref: this is the right tool, and everything above uses it.
- Metaobjects — standalone custom entries with multiple related fields, referenced from products (Shopify dev docs, "Metaobjects," accessed October 2026). The right tool when the data is its own record: a supplier profile (name, email, lead time, terms) that many products point to.
The mistake to avoid is modeling a supplier as five metafields on every variant (supplier_name, supplier_email, supplier_lead...). When the supplier's email changes, you're bulk-editing 400 variants. Create a supplier metaobject once, reference it from each variant, and update the record in one place. The reverse mistake is also real: a single bin_code string does not need to be a metaobject. One field, one metafield.
What belongs in a metafield vs the SKU vs a label
Three slots for location identity, and they answer different questions:
| Slot | Right for | Wrong for |
|---|---|---|
| The SKU itself | Anything that's part of the product's identity | Anything that changes: bins get re-slotted, suppliers get switched |
| Metafields | Operational attributes that change without changing the product: bin, supplier ref, lot, case pack | Data you need to do math on weekly in reports — metafields aren't in native inventory reports |
| Physical labels | What a human sees at the shelf | Anything not also recorded digitally |
The boundary worth respecting: SKU structure is identity — if your SKU encodes the supplier or the bin, every re-slot or re-source becomes a new SKU and your sales history fragments. Keep the SKU about the product (the SKU naming guide covers designing that), and let the metafield hold the mutable operational layer. Same rule at the shelf: the bin label is a print of what's in the metafield, not a competing record — the bin labeling guide owns the physical system.
Where spreadsheets still win
Honest limits of metafields for inventory ops, as of October 2026:
- No math. A metafield holds text and numbers; it doesn't compute days of cover or reorder points. Anything involving arithmetic on velocity stays in a spreadsheet or an app.
- Reports don't see them natively. Shopify's inventory and sales reports don't group or filter by custom metafields out of the box. If "sales by supplier" is a weekly need, you'll export and join in a spreadsheet — or keep supplier assignment in whatever tool does the grouping.
- Discipline is still manual. A metafield is a field, not a process. Lot numbers are accurate only if receiving records them — the lot tracking guide covers the process side that no field definition supplies.
The pattern that works: metafields as the system of record for static-per-variant operational data (bin, supplier ref, case pack), spreadsheet as the working layer where exports get joined and computed. When a scanning workflow enters the picture, the bin metafield is what the barcode lookup should resolve to — the barcode guide covers that pairing.
Common questions
How do I add a metafield to a variant in Shopify? Go to Settings → Custom data → Products and add a definition, choosing product variant as the owner type, with a namespace/key and a data type. The field then appears in the variant editor and, via the column chooser, on the Products list page. Values can be entered one by one, through the bulk editor, or imported via product CSV (Shopify Help Center, as of October 2026).
Can Shopify metafields store bin locations and lot numbers? Yes — both are just typed custom fields (single line text is the usual type) attached per variant. With a definition in place they become searchable and filterable in the admin, and they can be shown as columns on the product list. They don't participate in inventory math or native reports; they're reference data.
What's the difference between a metafield and a metaobject? A metafield is one custom field on a resource like a variant — a bin code, a lot number. A metaobject is a standalone structured record with multiple fields that resources reference — a supplier profile with name, email, and terms. Use metafields for single values; use a metaobject when many variants share one record that should be updated in one place (Shopify dev docs, accessed October 2026).
Do metafields cost extra or require an app? No. Creating definitions and values is native to every Shopify plan as of October 2026, and the per-variant metafields you create in Settings → Custom data are editable in the admin, bulk editor, and CSV. Apps are only needed for specialized validation, app-owned fields, or storefront display logic beyond what Liquid and the theme editor already offer.
Why won't my metafield show up on the product page? Two common reasons: the field is attached to the product but you're looking for it on variants (or vice versa — owner types are separate), or the theme doesn't render it. Admin visibility is controlled by the column chooser and the variant editor; storefront display requires theme code or dynamic sources to reference the metafield (Shopify Help Center, as of October 2026).
Next step: create one definition today — inventory.bin_code, single line text — and backfill your 20 fastest movers with the bulk editor. If you find yourself maintaining the same values in both Shopify and a spreadsheet, the metafield has won; delete the spreadsheet column.