📣🎄🎁❄️ WINTER SALE! | Exclusive offers for Cloud Shared Hosting - 70% OFF | Starting from $3.99/mo
Learn Magento 2

One of the most used Opensource E-Commerce Platform build on Enterprise level!

• Last Updated: 01/10/2020
• ( 15 minutes reading )

How to create Product Attributes and Attribute Sets in Magento 2

Introduction

Product attributes are additional pieces of structured information defining your products. We believe that as a store owner you strive to provide as much information as possible for your products and improve your users’ experience. Magento comes with built-in system attributes, such as price, description, image, etc. in addition to which you will be able to create custom attributes depending on the goods you will be selling.

 

Adding Product Attributes

In order to add your custom attribute, please log in to your Magento Admin Dashboard and navigate through the left menu bar to Stores > Product.

 

Accessing the Product Attributes page

 

On this page, you will see listed all currently available attributes. You will be able to edit or remove existing attributes. Please note that the default “system attributes” created by Magento cannot be removed. The default attributes are marked with “Yes” under the “System” column.

 

Adding new attribute

 

Now, in order to add your new attribute, please click on the “Add New Attribute” button.

You will see that the “Add New Attribute” page is divided into three “Properties”, “Manage Label”, and “Storefront Properties” tabs where you need to configure the accordant settings.

Let’s first review the “Attribute Properties” section under the “Properties” tab.

 

Attribute Properties

 

Under the first “Default Label” you will need to enter the title that will identify the attribute in your store’s backend.

From the second “Catalog Input Type for Store Owner” dropdown menu you will need to select the data input type that will be used for managing the products assigned to this attribute. You will be able to choose between the following data input types:

  • Text Field - Will provide a single input field for text.
  • Text Area - Will provide a multiline input field for a text which could be used for description and formated in HTML.
  • Text Editor - Will provide a functional text editor.
  • Date - Will allow entering date values by directly inputting them or selecting them from a pop-up calendar.
  • Yes/No - Will display a button with only “Yes” and “No” options.
  • Multiple Select - Will display a dropdown list of options that accepts multiple selections.
  • Dropdown - Will display a dropdown list of multiple options that will accept a single selection.
  • Price - Will display price fields that are in addition to the predefined “Price”, “Special Price”, “Tier Price”, and “Cost” attributes.
  • Media image - Will associates an additional image (e.g. product logo) along with Base, Small, and Thumbnail images for the product.
  • Fixed Product Tax - Will allow defining Fixed Product Tax rates depending on the requirements.
  • Visual Swatch - Will display a visual swatch that can present colors (in hexadecimal color value), materials, textures, and images.
  • Text Swatch - Will display a text swatch that presents configurable options. It is often used for the size attribute.

Depending on the input type you select you will be provided with an additional meta box where you will need to create the attribute values. In our case, we have selected the “Visual Swatch” input type for our “Color” attribute. You will be able to add new attribute values by clicking on the “Add Swatch” button available at the bottom of the meta box. Please note that the text in the button may vary depending on the input type you have selected, but it is always located at the bottom of the meta box as shown in the following screenshot example.

 

Creating Attribute Values

 

Another thing we would like to point out is that once selected, the “Catalog Input Type for Store Owner” cannot be changed in the future.

The last “Values Required” setting determines whether attribute value needs to be entered in order to create a product assigned to this attribute.

Please, expand the following “Advanced Attribute Properties” section located right below.

 

Advanced Attribute Properties

 

Within the first “Attribute Code” you will need to enter the unique attribute identifier which is intended for internal use.

From the “Scope” dropdown menu you will be able to select the website level on which the attribute will be used.

Within the “Default Value” field you will be able to determine the default value for products assigned to this attribute. Please note that default value cannot be set for the “Multiple Select”, “Dropdown”, or “Fixed Product Tax” input types.

If the “Unique Value” is set to “Yes” the value selected for this attribute can only be used for one product and no other product can have this value. We believe in most cases you would want it set to “No”.

From the “Input Validation for Store Owner” dropdown menu you can select a validation method that will be used to verify any data entered into a text field.

The “Add to Column Options” setting determines whether the attribute will be displayed in the product grid on your store’s backend.

The last “Use in Filter Options” setting determines whether it will be possible to use the attribute as a filter control on your store’s backend.

Now, please expand the second “Manage Labels” tab.

 

Manage Labels

 

You will be provided with only one “Default Store View” field where you will need to define the label of the attribute as it will be displayed on your store’s frontend.

Next, please expand the last “Storefront Properties” section where you will find the settings that will allow you to control how the attribute interacts on your store frontend.

 

Storefront Properties

 

The first “Use in Search” setting determines whether the attribute values could be used for product searches in your catalog. If you would like to enable this functionality, please make sure to set it to “Yes”.

The second “Comparable on Storefront” setting determines if the attribute value will be shown on the product compare page. Magento allows your customers to select two or more products based on which a compare report is created - if you choose “Yes” the attribute will be included in this report.

From the following “Use in Layered Navigation” dropdown you can determine whether the attribute will be included in the layered navigation and could be used for filtering the products. If set to “Yes” your customers will be able to select the attribute from the catalog and category page and filter the products by the given attribute. Please note this setting is only available for “Dropdown”, “Multiple Select” and “Price” input types.

From “Use in Search Results Layered Navigation” you can determine whether the attribute will be included in the layered navigation for search results.

From the “Position” field you can determine the position of the attribute in layered navigation compared to other filterable attributes. Please note that in order to enter the desired value you will need to save the attribute and then edit it.

The “Use for Promo Rule Conditions” setting determines whether you will be able to use this attribute in your promotional codes. If it is set to “Yes” you will be able to specify certain value(s) of this attribute for your promo codes.

 

Additional Storefront Properties settings

 

The “Allow HTML Tags on Storefront” setting is applicable only to the “Text Field” and “Text Area” input types. If set to “Yes” it will allow you to format the attribute value with HTML tags.

The“Visible on Catalog Pages on Storefront” setting controls whether the attribute is included in the “Additional Information” tab of the product page. Please note that it is applicable only to “Simple” and “Virtual” product types.

The last two “Used in Product Listing” and “Used for Sorting in Product Listing” settings depend on the theme you are using for your store, therefore the values you select here could be overridden by your theme settings. “Used in Product Listing” determines whether the attribute will be displayed in product summaries that appear in catalog listings. “Used for Sorting in Product Listing” determines whether the attribute will be available in the product listing type dropdown menu on your store’s frontend.

Once you are ready with all the settings, please click on the “Save Attribute” button or on the “Save and Continue Edit” in case you need to perform any additional changes.

That is it! At this point, you have learned how to create your custom attributes and you are ready to move forward.

 

Creating Attribute Sets

Attribute Set” is a suite of specific attributes associated with a given type of product. The attribute set determines the available fields during data entry and the values that appear on the frontend product pages. Magento comes with a “default” attribute set which includes commonly used attributes. Although depending on the products you are selling on your online store you will probably need to create your custom attribute sets.

Please navigate through the left-hand side menu bar in your Magento Admin Area to Stores > Attribute Set.

 

Accessing the Attribute Set page

 

On the “Attribute Sets” page you will see listed all currently available attribute sets. In order to add a new one, please click on the “Add Attribute Set” button.

 

Adding Attribute Set

 

Please enter the title of the attribute set into the “Name” field. Then, from the “Based On” dropdown menu you will need to select the attribute set on which the current one will be based - in other words, all the attributes included in the selected set, the way they are structured and organized will be assigned to the new set. Finally, please click on the “Save” button.


Entering Attribute Title

The structure under “Groups” will display all the attributes included in the set grouped into different folders. The list under “Unassigned Attributes” displays all the attributes which are not included in the set.

 

Configuring the Attribute Set

 

You will be able to add new groups or delete existing groups by clicking on the corresponding  “Add New” and “Delete Selected Group” buttons at the top.

By clicking on the plus (“+”) icon in front of each folder you will be able to list and review all the attributes included in the group. You are able to remove unneeded attributes by dragging and dropping them into the “Unassigned Attributes” list. Oppositely, if you need to include a given attribute to the set, you can select it from the “Unassigned Attributes” list and drag and drop it under the desired folder. As you have probably noticed, some of the attributes are marked with a red sign - these are the default Magento attributes that can not be removed.

Once you organize and customize the attribute set per your preferences, please do not forget to click on the “Save” button.

 

Very well! At this point, you know how to create your custom Product Attributes and Attributes Sets. Now you will be able to manage your products in an efficient way and ensure your customers will be provided with all the necessary information. We hope you have found our tutorial useful and easy to follow and we would like to welcome you to contact our Support Team in case you have experienced any sort of difficulties.



...
Sebahat
Technical Support Captain

Sebahat is a young and bright woman who has become an invaluable part of our team. She started as a Customer Care Representative, mastering that role and, along the way, growing into a tech-savvy individual who is well acquainted with every support layer of the company. Driven by her aim to improve our customers’ experience constantly, she is committed to enhancing the extraordinary support we deliver.