Importing categories is useful if you want to add categories to the store or edit them in bulk.

For data import/export, X-Cart uses CSV files. Such files can be edited using any popular spreadsheet editor like MS Excel or LibreOffice Calc.

You can use 2 different types of CSV files to import categories:

  • categories.csv - allows creating new categories and updating existing categories details;

  • products.csv - allows assigning products to existing categories and create new categories while assigning products to them; does not allow maintaining category details.


If you have a CSV file exported from some other source (a list from a supplier, an export file from some 3rd party store, etc.), you need to rebuild it to X-Cart's format. If the format doesn't match, the import fails.

Learn more about the X-Cart Categories CSV file format here.


Managing Categories via the Categories.CSV File

A categories.csv file allows creating and updating categories, including all category details. This is how a sample categories.csv file may look:

You can change the category ID, path, image, description, etc., or even delete some category details if required — a full list of fields supported by a Categories.CSV file you can find here.

If you will import category data into X-Cart and do not wish to update certain fields during the import process, you should not include these fields in your CSV file for import. Remove the respective column(s) from the file.

If necessary, you can use import to clear previously set field values for non-numeric fields. To clear a field value, in a CSV file to be imported, specify the value of the field as “NULL.” After the import process is completed, the fields for which the value “NULL” has been imported will be cleared.

This feature is supported by the following fields in the categories.csv file:

  • memberships;

  • image;

  • banner;

  • productClasses.

For any other fields, e.g., description, you can put the space HTML character ( ) to clear the value and update the database records.

Assigning Products to Categories via the Products.CSV File

The products.csv file is a general file for importing all product-related info. You can use this file to add create new categories and assign products to them. Since products.csv contains all products related data, the file structure is rather complex.

The field that controls the category-related data is categories. You can use this field to specify the category a product is assigned to. Also, you can use the inCategoriesPosition field to define the products' order within a category.

This is how a products.csv file may look if it contains only the categories-related data.

If you want to assign a product to a different category, change the value of the "categories" field for this product. If you specify a non-existing category for a product to be updated, this category will be created in your store during import.

If you want to cancel a product assignment to a category, set a “NULL” value for the "categories" field.

Did this answer your question?