A batch is a quantity produced under practically identical conditions. A serial number belongs to exactly one unit. In the ERP these are two different data structures, in the shop two different displays, and in an emergency both decide how tightly a recall can be drawn. This article shows where the numbers sit in the data model, which rules EU law sets for them and how to build an ERP integration for the shop that carries traceability instead of getting in its way.
Key takeaways
- Batch and serial number are different levels: the batch belongs to the lot, the serial number to the individual unit.
- Article 18 of the General Food Law Regulation 178/2002 requires one step back and one step forward, and has done so since 1 January 2005.
- For food of animal origin, Implementing Regulation 931/2011 lists eight data items per consignment.
- GS1 encodes the batch as application identifier 10 and the serial number as 21, both up to 20 characters.
- The number is rarely visible in the catalogue, but regularly on the delivery note, in the customer account and in the return.
- Without a documented link between order line and number, a recall stays a search through stock.
What the law asks for
In the food sector, traceability is not a voluntary exercise. Article 18 of the General Food Law Regulation 178/2002 requires it to be established at all stages of production, processing and distribution, and requires every operator to be able to identify any person from whom goods have been supplied. That duty has applied since 1 January 2005 (General Food Law Regulation), because Article 65 sets exactly that date for Articles 14 to 20. Translated into daily practice: one step back to the supplier, one step forward to the commercial customer. The private end consumer is explicitly not part of that chain, and the distinction matters for any shop that supplies businesses and private buyers at the same time. Anyone who leaves it out of the mapping between ERP and shop will collect either too much or too little.
For food of animal origin, Implementing Regulation 931/2011 goes one step further. It lists eight data items (Implementing Regulation 931/2011) that the supplier has to make available to the recipient: among them an accurate description of the food, the volume or quantity, the name and address of the consignor and of the consignee, a reference identifying the lot, batch or consignment, and the date of dispatch. It has applied since 1 July 2012 (Implementing Regulation 931/2011). A shop carrying such goods needs to be able to pull those fields out of the ERP rather than out of a spreadsheet in the sales department. Anyone selling entire ranges of this kind will find the requirements collected in our overview of ERP integration for food and beverage.
Batch and serial number are two different levels
A batch groups a quantity that was produced, manufactured or packaged under practically identical conditions. Directive 2011/91/EU calls this a lot and requires an indication that allows the lot to be identified. It is preceded by the letter L (Directive 2011/91/EU) unless it is clearly distinguishable from the other indications on the label. Exempt are, among others, packages and containers whose largest surface measures less than 10 square centimetres (Directive 2011/91/EU). The lot is determined by the producer, manufacturer or packager or by the first seller established within the Union, not by the dealer who passes the goods on.
A serial number, by contrast, designates exactly one unit. It does not originate in production planning but where a single device receives its own rating plate. For a merchant the difference is tangible: a batch can be assigned to an order line with a quantity, a serial number requires an assignment per unit. Ten devices on one line mean ten records, not one. Squeezing both levels into the same field destroys exactly the precision needed in an emergency, and produces stock control across several warehouses that knows quantities but no origin.
Batch or lot
One number for many units. It is created at goods receipt or in production, belongs to stock and storage bin and travels on through partial quantities. Repacking usually creates a new batch with a reference to the original one.
Serial number
One number for exactly one unit. It is assigned during picking or final inspection and stays with that unit through warranty, repair and return.
Expiry date
No substitute for a number, but its constant companion. GS1 encodes it as application identifier 17 with six digits (GS1) in YYMMDD format, without separators and without leeway.
Where the number sits in the data model
In the ERP the decision hangs on a flag in the item master: batch managed, serial number managed, or neither. That flag drives everything else. If an item is batch managed, stock is no longer held only per warehouse and bin but additionally per batch. One stock row becomes many. If an item is serial number managed, stock is held per unit, and the quantity of a stock row is one by definition. Both cases change the stock interface to the shop fundamentally, because the total across all batches has to arrive in the shop while the split behind it is preserved. It works much like units of measure and pack sizes: the shop sees a number, the ERP keeps the structure.
On the shop side a plain rule applies: the item does not carry a batch. Only the order line receives one, and only at the moment of picking. Before that the field stays empty, because before that nobody knows which lot goes into the box. Showing the batch number in the catalogue is a promise that picking will withdraw again. The sensible route runs the other way: the shop sends the order, the ERP reports an addition to the line back after picking, and the order status in the customer account displays it as soon as it is settled.
The number belongs to the movement, not to the item
{
"order_id": "A-2026-004711",
"status": "picked",
"line_items": [
{
"line": 10,
"sku": "FL-0815",
"quantity": 24,
"unit": "H87",
"batches": [
{ "batch": "L-2609-A", "quantity": 18, "best_before": "2027-03-31" },
{ "batch": "L-2609-B", "quantity": 6, "best_before": "2027-05-15" }
]
},
{
"line": 20,
"sku": "GT-4400",
"quantity": 2,
"unit": "H87",
"serials": ["SN-4471", "SN-4475"]
}
]
}What the shop shows of it
Not every number has to be visible in the shop. It becomes visible where it helps a person make a decision or where a rule demands it. On the product page it rarely helps; on the delivery note and the invoice it certainly does, because that is where complaints start. With items that have many characteristics, the number belongs to the variant rather than to the parent item, which also shapes how product variants from the ERP are represented. The following order has proven itself in projects.
- Order confirmation without a number. At the time of confirmation nothing has been picked yet. A number at this point would be guesswork.
- Delivery note with a number per line. Here it is settled what left the box: batches as a list with partial quantities, serial numbers as an enumeration.
- Invoice with a number where no delivery note travels along. With paperless direct shipping the invoice is the only document that reaches the customer.
- Customer account with history. Someone looking for a serial number looks for it months later, not on the day of delivery.
- Return form with a preselection. In the returns process between shop and ERP the customer picks the serial number from the delivery instead of typing it.
- Service area with certificates. Certificates of analysis and declarations of conformity belong to the batch, not to the item, and belong as a file on the line.
The recall is the real test
A recall is the moment that shows whether the data holds up. The question then is not about the item but about the batch: which deliveries contained L-2609-A, who received them, and how much is still in the warehouse? Anyone who can only obtain that answer through a full-text search in delivery notes loses hours. Anyone with a table that links order line and batch number answers it with one query. The difference is not technical polish, it is the difference between a contained and a complete recall. A clean interface ships that query as an endpoint instead of rebuilding it each time.
The EU General Product Safety Regulation 2023/988 picks up the thread. It requires products to bear a type, batch or serial number or another element easily identifying them, and it has applied since 13 December 2024 (GPSR 2023/988). For the recall notice addressed to consumers it explicitly prescribes that production identification numbers such as batch or serial number appear in it, where appropriate with a graphical indication of where they can be found on the product. A recall notice without that information does not meet the requirement. For merchants this means the number has to live not only in the ERP but also be retrievable in customer communication.
| Question in an emergency | Without batch control | With batch control |
|---|---|---|
| Which deliveries contained the lot? | Review of all delivery notes in the period | Query across the line table |
| How much is still in the warehouse? | Physical count | Stock row per batch |
| Which supplier delivered it? | Inference from the order date | Link from goods receipt to batch |
| Which customers are affected? | Search by item number, many false hits | Hits per order line |
| How fast is the answer available? | Hours to days | Minutes |
| What goes into the audit report? | Recollection and estimate | Documented chain per stage |
GS1 application identifiers as a shared language
For a number to keep the same meaning across ERP, shop, warehouse and carrier, it needs a shared encoding. GS1 solves this with application identifiers placed in front of the value. The batch carries identifier 10 (GS1), the serial number carries identifier 21 (GS1). Both are alphanumeric and up to 20 characters (GS1) long. The expiry date carries identifier 17 and consists of exactly six digits in YYMMDD format. Anyone who knows these three identifiers reads most of a shipping label without a manual.
Two sober consequences follow for the interface. First, a field of 20 characters is the safe lower bound in the data model; planning tighter fails at the first supplier with speaking numbers built from date and production line. Second, in a GS1 data carrier the batch is not a standalone value but a qualifier for the item number: only item number plus batch produces a reliable statement. Scanning the data carrier at goods receipt delivers both in one go and books without a keyboard. That is exactly where the data quality is created that is later needed when connecting shipping and logistics systems.
UDI and the battery passport: two special routes
Medical devices go their own way. EU Medical Device Regulation 2017/745 prescribes a unique device identification, the UDI. It consists of two parts (MDR 2017/745): the UDI-DI for the device model and the UDI-PI for production. Lot number, serial number, software identification and expiry date form part of the UDI-PI once they appear on the label. For a shop this means the serial number does not sit loosely next to the item number but is bound to it in a defined structure. Assembling that structure only in the output template means not having it.
Batteries receive a digital battery passport from 18 February 2027 (Batteries Regulation 2023/1542), covering LMT batteries, industrial batteries with a capacity greater than 2 kWh (Batteries Regulation 2023/1542) and electric vehicle batteries. The passport holds information on the battery model and information on the individual battery, so it is unthinkable without a serial number. Independently of that, the same regulation already requires batteries placed on the market to bear a model identification and a batch or serial number. Anyone carrying batteries should therefore treat serial control not as a special case but as the coming default. The proximity to the digital product passport under the ESPR is obvious.
Three bodies of law, one data field
Returns, warranty and the number on the unit
Returns reveal whether the serial number really belongs to the unit. When a device comes back, the inspection has to be able to establish whether it came from this delivery. Without a serial number that is a question of trust. With a serial number it is a query. The difference gets expensive the moment a device arrives that was not sold through your own shop at all. A middleware between shop and ERP can run that check before the return is even created.
The time limits argue for the number on the unit as well. Claims based on a defect become time-barred under the German Civil Code after two years (German Civil Code) as a rule, counted from delivery of the goods. Anyone wanting to prove shortly before that limit expires when which device was delivered needs the assignment made back then, not the recollection of today. That holds for seller and buyer alike, and it is a good argument for making the serial number visible in the customer account instead of keeping it in the database only.
How long the data has to stay
The retention question has no single answer. Commercial and tax obligations apply to documents, product law obligations to technical documentation, and limitation periods set a third deadline. In practice this means the link between order line and number belongs in audit-proof storage, not in a log that rotates after a few weeks. Anyone documenting the interface should record that link explicitly in the process documentation, so that it stays traceable later which system created the number and which one only mirrored it.
Implementation in eight steps
- Clarify the item master: which items are batch managed, which are serial number managed, which are neither?
- Extend the stock interface: total to the shop, split per batch kept in the ERP.
- Set field lengths: 20 alphanumeric characters for batch and serial number, six digits for the expiry date.
- Build the callback: the ERP completes the order line after picking, not before.
- Extend the documents: delivery note, invoice and customer account show the number per line.
- Wire up returns: the return form selects from existing serial numbers instead of allowing free text.
- Test the lookup: one query answers in both directions where a batch came from and where it went.
- Define retention: the link is preserved for as long as the longest applicable period.
The traceability of food, feed, food-producing animals, and any other substance intended to be, or expected to be, incorporated into a food or feed shall be established at all stages of production, processing and distribution.
Sources and studies