Skip to main content

Management of product stock data with CSV export and import in X-Cart 5.6.x

A
Written by Anna Verbichenko
Updated this week

In X-Cart 5.6.x, you can manage product stock levels through the built-in Import/Export feature using two CSV files:

  • products.csv

  • inventory.csv

Working with products.csv

The easiest way to explore the format of the products.csv file is to export products that already exist in your catalog.

Export

You can export product data to products.csv in two ways:

Method 1. From the Products page (Catalog → Products)

  • Use the Export all:CSV / Export selected:CSV tool in the sticky panel.

Method 2. From the Import & Export page (Catalog → Import & Export → Export)

  1. Under Select What to export, check the box for Products.

  2. (Optional) Check the Advanced settings to ensure the CSV file will have the correct CSV delimiter.

  3. Click Start export.

Import

To update existing product data (for example, stock levels), you can edit the exported products.csv CSV file and re-import it:

  • Go to Catalog → Import & Export → Import and upload the edited products.csv.

Stock Data in products.csv

The stockLevel field in products.csv represents the Total stock value for a product - the combined stock from all sources except for the Backorder location.

For full field specifications, see CSV Import: Products.

You can use products.csv to:

  • Export stock values for products;

  • Import stock values (with limitations).

Important: Single vs Multi-Location Stores

X-Cart 5.6.x supports multiple stock locations. Because of this, behavior differs depending on configuration:

Store type

Behavior of stockLevel on import

Single location stores

stockLevel updates both Total stock and the quantity for the single location

Multiple locations stores

stockLevel is ignored — the system cannot apply one total value across multiple warehouses automatically

If your store uses more than one location, use inventory.csv to import stock quantities instead.

For more information about warehouse locations, see Location Management in X-Cart 5.6.x.

Working with inventory.csv

Use inventory.csv to export/import product quantities per location. This format supports both single- and multi-location inventories.

Export

Export through inventory.csv is supported for all locations.

You can export inventory.csv in two ways:

Method 1. From the Inventory page (Catalog → Inventory)

  • Use the Export all:CSV / Export selected:CSV tool in the sticky panel.

Method 2. From the Import & Export page (Catalog → Import & Export → Export)

  1. Under Select What to export, check the box for Inventory.

  2. (Optional) Check the Advanced settings to ensure the CSV file will have the correct CSV delimiter.

  3. Click Start export.

Import

Import through inventory.csv is supported for local stock only.

To update stock levels for products, you can edit the exported inventory.csv CSV file and re-import it:

  • Go to Catalog → Import & Export → Import and upload the edited inventory.csv.

Stock Data in inventory.csv

CSV file format:

sku,[LocationCode1],[LocationCode2],...,[LocationCodeN]
  • sku - column header for product SKUs;

  • LocationCodeX - actual warehouse location code (each warehouse has its own unique code).

Example structure (illustrative):

sku

WAREHOUSE_NY10008

WAREHOUSE_NY10001

PROD-001

8

3

PROD-002

2

1

Here:

  • PROD-001, PROD-002 — SKUs,

  • WAREHOUSE_NY10008, WAREHOUSE_NY10001 — location codes,

  • Values (e.g., 8, 2, 3, 1) — stock quantity of the product at specific locations.

Required fields are marked with an asterisk (*):

Each product line must include its SKU and at least one location code column corresponding to an existing location in your store.

CSV file field name

What this field describes

sku*

Unique identifier of the product.

String,
Max. length: 32

<locationCode = String, Max. length: 32>*

Quantity of the product in this location

Quantity value syntax:

N = Overwrite stock with N

+N = Increase stock by N

-N = Decrease stock by N

Integer


Can't find answers you're looking for?

Email us at support@x-cart.com. We will be happy to help!



Did this answer your question?