File Format - Inventory
For PATCH support, continue to follow this specification described below but prefix the file: “TPIN_”. Normally, all operations in File Importer are PUT, but with “TPIN_” file we can PATCH inventory. With PATCH you can change existing or add new inventory entries for a product/variant. PUT will replace all inventory entries for a product/variant with the data in the payload.
Inventory File Format
The first line of an Inventory CSV file must be the header row.
An inventory instance is a group of rows in the CSV file that are sequential and include the same required fields. Data relating to fields specified under Base Headers and Multi-Column Headers must be specified in the first row of an inventory instance. Additional rows of an inventory instance may only include fields specified under Multi-Row Headers.
Required Headers
To successfully import an inventory CSV file, the following columns must be included in the header row:
Column Name | Description | Type |
---|---|---|
Product ID | Unique Identifier of the product this inventory is associated with. If not provided, lookup via variantId will be performed. | string |
Variant ID (Required)* | Unique Identifier of the variant this inventory is associated with. Use ‘0’ if this is a product without variants | string |
Groups
A group is a class of headers that relate to one another. Groups may allow for multiple pieces of information to be presented. For example, a customer can have multiple emails, addresses, phone numbers, and more.
Inventory groups include the following – see below for details:
Store Inventories
There are two ways that store inventory columns (Store ID and Store Count) can be formatted in your CSV file: Multi-Row Approach or Multi-Column Approach.
Multi-Row Approach
In this approach, one set of column headers is used alongside multiple rows of data. To allow for multiple rows of data, additional rows must include the same Required Headers fields.
Multi-Column Approach
In this approach, multiple sets of column headers may be used alongside one row (the first row) of an inventory instance. To use these columns multiple times, an identifying number must exist for N and be unique for every new set of columns.
Columns from the Multi-Row Approach cannot be mixed with columns from the Multi-Column Approach in a CSV file for the Store Inventories group.
The following columns may be included:
Multi-Row Approach Column Name | Multi-Column Approach Column Name | Description | Type |
---|---|---|---|
Store ID (Required)* | Store N ID | ID of the store for which this is an inventory listing | string |
Store Count (Required)* | Store N Count | Number of items available in inventory | integer |
Inventory CSV Example
Examples shall clarify the approaches defined above. See the following Inventory CSV sample file.