Attributes import can help when a store admin creates and assign multiple attributes of different types and values to several or all store products.

Attributes.csv is a file aimed at creating products' attributes as database entities. Using this file, a store admin can create attributes of different types and populate a store with them. Unfortunately, the file doesn't allow assigning attributes to products.

A file that allows both to create attributes of different types and assign them to products is product-attributes.csv.

Also, it's possible to use the products.csv file for the attributes import and assignment. However, this file is too complex and doesn't define the attribute field value types. So it's better to use the other two options.

A store admin can get each of the files mentioned above by exporting them via the Export section of the Admin area:

export-classes.png

Here the Products checkbox stands for a products.csv file, Classes & Attributes - for attributes.csv, and Product attribute values - for product-attributes.csv.

Importing Attributes via the Attributes.CSV File

The attributes.csv file allows populating a store database with product attributes but not assigning these attributes to products. Use this file when adding new or editing existing attribute values.

Let's consider a sample attributes.csv file below:

import-attributes-csv.png

The file contains all possible attributes by scope - global, product-class, and product-specific attributes.

You can recognize global attributes by the type, name, and options fields filled in a row. For example, if a row also has the class field defined, it stands for a product-class attribute.

A product-specific attribute has the type, product, name, and options fields filled in a row.

The position and group fields are optional for any of the attributes.

To get more info about field definitions and value types, see CSV Import: Classes & Attributes.

Importing Attributes via the Product-Attributes.CSV File

The product-attributes.csv file allows populating a store database with product attributes, assigning attributes to products, and adding price and weight modifiers. Use this file to add new attributes to the database and configure the store products with the required attributes.

Let's consider a sample product-attributes.csv below:

import-products-attributes-csv.png

The file contains data on all possible attributes by scope - global, product-class, and product-specific attributes with the configured attribute options, values, modifiers, and product SKUs they are assigned to.

Global attributes can be recognized by the productSKU, type, name, owner, and value fields, where the owner field has the value NO.

Product-specific attributes must have all the same fields filled in, BUT the owner field value must be YES.

Product-class attributes should have all the same fields defined as global attributes (with the owner field value = NO) PLUS the field class.

If a store admin changes the value of the owner field from YES to NO and vice versa for an existing products attribute during data import, a new product of a different attribute type will be created due to data import. However, the old product will remain as is.

You must write each new attribute option for the same product SKU in a separate row with a different value field value.

The group, default, priceModifier, weightModifier, editable, attributePosition, and valuePosition fields are optional.

You can define the priceModifier and weightModifier fields only for multivalue attribute options of S (Plain Field), C (Yes/No), and H (Hidden) attribute types.

You can use the editable field only for an attribute of the T (TextArea) type.

To get more info about field definitions and value types, see CSV Import: Product Attribute Values.

Importing Attributes 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 new and edit existing attributes and assign attributes to products. Since products.csv contains all product-related data, the file structure is rather complex.

Let's consider a sample products.csv below:

The sample file contains only the attribute-related fields for the sake of example.

import-products-csv.png

The file contains data on all possible attributes by scope - global, product-class, and product-specific attributes with the configured attribute options, values, modifiers, and product SKUs they are assigned to.

The attribute-related fields in a products.csv file have a unique column mask [attribute_name]: (field:[attribute_type]), where [attribute name]stands for the name of a particular attribute and [attribute_type] stands for a type of attribute by the scope and can vary. Possible values are as follows:

  • global for global attributes;

  • class for product-class attributes;

  • product for product-specific attributes.

Product-class attributes must also have the productClass field defined, as you can not add product-class attributes without a related product class created first.

A products.csv file doesn't specify the value type of an attribute field. Hence when you create an attribute via a products.csv file, you'll get either a plain field or a Yes/No value type of an attribute field by default.

To get more info about field definitions and value types, see CSV Import: Products.

Related pages:

Did this answer your question?