How to import Magento 2 product and custom attributes

- E-Commerce, Magento 2

In this blog article we will talk about how to import product attributes, attribute groups and attribute sets to Magento 2 store. How the attributes behave and which values Magento 2 understands in the import tables.

Importing products to Magento 2 is impossible without product attributes. They dictate which values the products have, which options and variations. That’s why having the ability to import product attributes is a must

This blog post is a part of FireBear Studio GuideList to Magento 2 import and export processes. In the Guide List you can find answers and detailed instructions on how to import any entity to your Magento 2. Every guide features a complete sample import table for Magento 2 with every attribute explained.

Read Magento 2 import and export Guide List

How to import product attributes to Magento 2

As you probably know, and why are you reading this article, Magento 2 doesn’t let you import product attributes. That’s why FireBear Studio developed and is constantly updating Improved Import and Export extension for Magento 2, which CAN import and export Magento 2 EAV and custom attributes.

With Improved Import and Export extension for Magento 2 you can import and export product attributes. Edit these attributes in a separate Google Sheet with your colleagues. Add new or remove irrelevant and import attributes back to Magento 2 store at the scheduled time and date. This can be pretty handy when you are building new supplier chain.

More information about Improved Import and Export extension can be found at the product page. If you require detailed instructions on how to use the extension –  read User Manual.

How it works

In this chapter we will refer to working with Improved Import and Export extension. If you want to follow the instructions along and do not have the extension yet – please – use the Live Demo.

The attribute import goes the same way you are importing products, customers or other stuff to your Magento 2:

  • First, you need a table with attributes.
  • Second, you need to know how to edit the table and which values are supported for attributes.
  • Third, you need to import the attributes with Improved Import and Export extension.

Let’s start from the beginning and talk about the table and how it looks.

Magento 2 product attributes import table

We try to gather sample import tables for all import entities supported by Improved Import and Export extension in the Google Sheet Master Table. By the link, you can find a sample table for importing product attributes. You can use it as a starting point for completing your own table.

If you want to compose your own table from the scratch, below you can find all attributes and sample values you will need to use when importing attributes to your Magento 2.

Attribute name Reference Values Value example
store_id Required column.

ID of the store view the attribute value belongs to.

When creating new attributes make sure to have store_id=0 for every unique value.

store_id=0 is responsible for Admin value of the attribute.

For attribute values for other store views use required store_id.

You can find store_id in the URL of the store view at Stores > All Stores > select required store view.

0
attribute_code                                        Required column.

Attribute Code used for internal identification purposes.

Value can’t contain spaces or contain more than 30 symbols. Color
frontend_label Default Label of the attribute. Consider it a an attribute name, when browsing the list of attributes. Can be any value Green color
option:value Required column.

Attribute option value.

Visible on frontend.

For example, for attribute ‘color’ it may be: red, green, yellow. Yellow
option:sort_order Order in which attribute option values are displayed. The lower the value, the higher the value is displayed. Priority of the attribute. Numerals only 10
entity_type Attribute entity Always product product
attribute_set Required column.

Name of the attribute set the attribute belongs to.

You can create NEW attribute sets by specifying unique value in this column.

You can find attribute_set values at Stores > Attributes > Attribute Set. default
group:name Name of the attribute group within attribute set the attribute belongs to. Can be any value First attribute group
group:sort_order Position of the attribute group within attribute set relative to other groups. Priority of the attribute group. Numerals only 10
backend_type Optional. Database value. Change only if you know what you are doing.
backend_table Optional. Database value. Change only if you know what you are doing.
frontend_model Optional. Database value. Change only if you know what you are doing.
frontend_input Catalog Input Type for Store Owner.

Defines how customer can choose attribute values.

Some of the input types do not require values. Like boolean – Yes/No. The values are available automatically.

Can be:

text – Text Field

textarea – Text Area

date – Date

boolean – Yes/No

multiselect – Multiple Select

select – Dropdown, Visual or Text Swatch

price – Price

media_image – Media Image

wee – Fixed Product Tax

multiselect
frontend_class Optional. Database value. Change only if you know what you are doing.
source_model                               Optional. Database value. Change only if you know what you are doing.
is_required Values Required. Defines if the attribute value must be selected in any case. 1 – yes, required value

0 – no, value is not required

1
is_user_defined Defines if it is a system attribute – that cannot be changed by the administrator.

You CANNOT change system attribute to user defined, Magento 2 does not allow it.

0 – can’t be defined by store administrator.

Means it is system attribute.

1 – can be defined by store administrator.

Generally, you want all custom attributes to be editable. With is_user_defined=1

1
default_value Defines if this row, this attribute option is selected by default. 1 – default attribute value

Leave blank if the value is not default

1
is_unique Unique Value, not shared with other attributes.

Attribute setting.

1 – is unique

0 – not unique

1
frontend_input_renderer Optional. Database value. Change only if you know what you are doing.
is_global Scope of the attribute. 1 – Global

2 – Website

3 – Store view

0
is_visible   Use in Filter Options – defines if the attribute is visible in the attribute grid in the administrator panel. 1 – yes, attribute is visible in grid

0 – no, attribute is invisible

1
is_searchable Use in Search. Is attribute available in search. 1 – yes, available

0 – no, not available

0
is_filterable                 Use in Layered Navigation. Defines if the attribute can be used in layered navigation. 1 – yes, can be used

0 – no, cannot be used

1
is_comparable Comparable on Storefront. 1 – yes, comparable

0 – no, not comparable

0
is_visible_on_front Visible on Catalog Pages on Storefront. 1 – visible

0 – hidden

1
is_html_allowed_on_front    Allow HTML Tags on Storefront. 1 – allow

0 – disallow

0
is_used_for_price_rules Can be used for price rules. 1 – yes

0 – no

1
is_filterable_in_search   Use in Search Results Layered Navigation. 1 – yes

0 – no

0
used_in_product_listing     Used in Product Listing. 1 – yes

0 – no

1
used_for_sort_by          position       Used for Sorting in Product Listing. 1 – yes

0 – no

0
is_visible_in_advanced_search Defines if the attribute is visible in advanced search. 1 – visible

0 – not visible

1
position Position of attribute in layered navigation block. The lower the value, the higher the position.

Can only contain numerals.

10
is_wysiwyg_enabled Use for Promo Rule Conditions. 1 – yes

0 – no

0
is_used_for_promo_rules Use for Promo Rule Conditions. 1 – yes

0 – no

1
is_required_in_admin_store   Defines if attribute is required in main store. 1 – yes

0 – no

0
is_used_in_grid Attribute is used in product grid. 1 – yes

0 – no

1
is_visible_in_grid Attribute is visible in product catalog. 1 – visible

0 – hidden

0
is_filterable_in_grid Attribute is filterable in product catalog. 1 – yes

0 – no

1
search_weight Defines the weight of the attribute in search. The higher the value, the higher the weight.

Can only contain numerals.

10
additional_data Additional attribute data.

Now that you which attributes of the attributes (no pun intended) to use, you can start composing and importing your own attributes using Improved Import and Export extension for Magento 2.

Creating an import job

Once you installed the extension you can find new export and export sections in the administrator panel, under System.

Here you need to select Import Jobs. That’s where you create and manage all the import jobs, set schedule and configure the import job execution. Export jobs are pretty similar, however with particular differences. If you want a full featured guide – read Improved Import and Export manual.

At the import jobs grid you get control over the basic job settings.

To create a new job click ‘Add New Job’ button. In the first section of the import job you will need to specify the job name for internal identification purposes and set the job schedule, if intend to run it automatically.

There are also other settings we omit in this guide. For the full settings description proceed to the extension manual.

In the next section you are suggested to select the entity you want to import to your Magento 2 store. In this guide we are importing attributes.

Then, you need to select the behavior of the import job: add/update, replace or delete. Select the behavior carefully and proceed to uploading the table with attributes.

Here you are suggested to specify the type of the file you will be importing. And selecting from where you want to import. Available sources include file upload, FTP/SFTP, Google Sheets, direct url and Rest/Soap APIs.

Once you selected the file from the specified source, hit ‘Validate file’ button and that’s it. You can now hit big orange ‘Save & Run’ button to start the import job.

Once the import is finished you will get a success log with information about how the import went.

Tips on importing attributes to Magento 2

With attribute import you can:

  • Create attributes and attribute values.
  • Create attribute sets. If the attribute you are importing belongs to attribute set that doesn’t exist – new attribute set will be created based on default attribute set.
  • Create attribute groups. Attribute groups within attribute sets can be also created automatically.
  • Attribute values will be created automatically according to the values you specify the import table.
  • You cannot change system attribute to user defined. Magento 2 does not allow such changes.
  • Pay attention to is_visible value. If the value will be ‘0’ the attribute will not be visible in the attribute grid of the administrator panel.

What is important to remember

Column is_user_defined plays very important role. It defines if it is a system attribute, or if user (the store administrator) can edit it manually. When importing attributes – make sure to pay attention to the value you specify.

Guide list

If you are looking for the guides on how to import other entities to Magento 2, or require step-by-step instructions with explanations on every product type – don’t forget to check on the Magento 2 import guide list.

Read Magento 2 import guide list