Magento 2 product attributes are generally the properties of the Magento 2 product that help customers choose between product variations and find the best suitable option. It could be color, size, weight, material etc.

Product attributes are used not only to define the Magento 2 product characteristics but also in the search that helps customers narrow down the results and improves customer engagement. Magento 2 product attributes can also be used for various kinds of rules like dynamic category rule, cms display rule, etc.

Magento allows you to create as many product attributes as you want each with its own type of input and assign them to the attribute sets which are the group of attributes characteristic of a certain kind of products.

In order to create a new product attribute in Magento 2 take the following steps:

1. Go to Admin Panel  >  Stores  >  Attributes  >  Product.

Magento 2 Product Attribute

2. Press the Add New Attribute button.

Mageneto 2 Product Attribute, Add New Attribute

3. Fill out the Attribute Properties section.

  • Enter a Default Label of an attribute. It will be displayed on the admin panel.
  • Choose a type of an attribute in the Catalog Input Type for Store Owner field. There are such available values here as: Text Field, Text Area, Date, Yes/No, Mutliple Select, Dropdown, Price, Media Image, Fixed Product Tax, Visual Swatch,Text Swatch.
  • Select yes in Values Required field in order to make the attribute required for products. In this case, you won't be able to save the product with this attribute if you don't set its value.

Magento 2 Product Attribute, Attribute Properties

4. Fill out the Advanced Attribute Properties section.

  • Set the Attribute Code. If you leave this field empty, the attribute code will automatically be generated from the default label.
  • In Scope you choose a level the attribute will be edited on. As far as Magento 2 is a multilingual and multi-website platform it is better if it is the text field attribute to leave it on a Store view level. In case attribute value doesn't depend on site or language it will be wiser to choose Global.
  • Set a Default Value of an attribute. We pay your attention to the fact default value won't be automatically set all existing products. It will be added only after the resaving of the product.
  • In the Unique Value field set Yes, if you don't want the same attribute value to be applied to different products, e.g. SKU attribute should be unique.

Mageneto 2 Product Attribute, Advanced Attribute Properties

5. In Input Validation for Store Owner select box set filter that will be used before saving a product to validate an attribute value.

6. Filter Yes in the Add to Column Options field in order to add the attribute to the list of column options in the product grid.

7. Choose Yes in Use in Filter Options field if you want this attribute to be used while filtering products.

Magento 2 Product Attribute, Advanced Attribute Properties

8. Set a Default Store View which will be displayed of the Storefront in Manage Labels section. In case you have a multilingual site, you can set a label for each language.

Magento 2 Product Attribute, Manage Labels

9. Configure the Storefront Properties.

  • If you want the attribute to be used while search, choose Yes in the Use in Search field.
  • In the Comparable on Storefront field you can select whether this attribute will be used on compare product page.
  • In Used in Layered Navigation you choose the attribute to be used in layered navigation.
  • You choose whether the attribute will be used in layered navigation search in the Use in Search Results  Layered Navigation.
  • In the Position field, you set the position of the attribute in the layered navigation.

Magento 2 Product Attribute, Storefront Properties

  • Choose Yes in the Use for Promo Rule Conditions field if you want this attribute to be used in rule conditions for cart price rules and catalog price rule as well.
  • In order to make the attribute displayed on a product page in additional options, choose Yes in the Visible on Catalog Pages on Storefront field.
  • Choose Yes in Use in Product Listing to add this attribute value to the PHP product object in a product list (product collection).
  • If you want the attribute to be used for the sorting process choose Yes in the Used for Sorting in Product Listing field.

Magento 2 Product Attribute, Storefront Properties

Once you have finished don't forget to press the Save Attribute button.

Magento 2 Product Attribute, Save Attribute

Assign to Attribute Set

Afterwards, go to Admin Panel  >  Stores  >  Attributes  >  Attribute Set, choose the attribute you need, drag and drop it from the Unassigned Attributes to Groups.

Magento 2 Product Attribute, Attribute Set Name

 

Once you have finished don't forget to save the attribute set.