agento 2 provides you with a flexible functionality to set properties to each product in a catalog. Attributes and attribute sets are one of the most powerful features in Magento. Using Magento product attributes you can set such product features as color, size, shape, etc. You can essentially customize the product attribute in Magento 2 to do everything you want. This post is meant to help Magento 2 beginners or anyone new to Magento become familiar with attributes so they can better manage their product data.

Lets walk through setting up an attribute on a default attribute set and see how it interacts with the product fields injected on the product display.

To create a new attribute, You will need login to your admin part and navigate to the Stores -> Attributes -> Product section of Store.

Now you will see the list of product attributes that comes with Magento 2 or created by you. In order to add new attribute click on Add New Attribute button.

It will open configuration panel for new attribute. so you can configure the attribute as per your requirement.

Here you will need to configure the Attribute Properties,

Default label – Name of the attribute used by the system. e.g: T-Shirt Color
Catalog Input Type for Store Owner – Define what kind of data the attribute will store
Values Required – Need to set as require or not

In this example we have selected dropdown input type. so now we can define the attribute Options (values of your attribute).

In the Advanced Attribute Properties you can setup.

Attribute Code – This is used internally. Make sure you don’t use spaces or more than 30 symbols.
Scope – Declare attribute value saving scope
Unique Value – Set this to Yes, if you want the data saved in this attribute to be unique for each product. Not shared with other products
Input Validation for Store Owner – Validate the data before applying changes to the attribute
Add to Column Options – Select “Yes” to add this attribute to the list of column options in the product grid.
Use in Filter Options – Select “Yes” to add this attribute to the list of filter options in the product grid.

Now you will need to click on the Storefront Properties tab from left panel to configure the frontend properties of the attribute.

In the Storefront Properties you can setup.

Use in Search
Comparable on Storefront
Use in Layered Navigation
Use in Search Results Layered Navigation
Position
Use for Promo Rule Conditions
Allow HTML Tags on Storefront
Visible on Catalog Pages on Storefront
Used in Product Listing
Used for Sorting in Product Listing

Now click on Save Attribute button to save your configuration for new product attribute. Clear cache from cache management.

You will need to assign recently created attribute to attribute set. so you will need to navigate to the Stores -> Attributes -> Attribute Set section. Now you will get list of attribute set available in your store and select as per your requirement.

Now you need to drag & drop attribute e.g: t-shirt-color from Unassigned Attributes to Groups section.

Once you have configured the set the way you would like it, Click Save Attribute Set in the top right.