How to create attribute in magento2

What is attribute?

The attributes which are the block of your product in catalog enable to point the existing characteristics of your product. You are allowed to create as many attributes as you need for each product in Magento 2 configuration. Each attribute will approve only one type of input that you will assign in the settings. Beside give additional information of the product, the attributes are also used as search parameters and criteria to filter in layered navigation, product comparison reports, and promotions.

Step1:Go to Admin panel Login with user name and password

Step2:Admin panel dashboard will show like below snap shot

Step3:After that we will go on Admin sidebar.

Step4:After that click on Stores->Attributes->Product.

Step5:Click Add New attribute button like below snap shot.

Attribute page will show like this

Step6:Fill all Attribute properties details and Advance Attribute Properties details.

In the Attribute properties:-

  • Default Label– Enter a default label to indentify the attribute.
  • Catalog Input Type for Store Owner field Select the type in input control to be used for data entry.
    • Text Field
    • Text Area
    • Date
    • Yes/No
    • Multiple Select
    • Dropdown
    • Price
    • Media Image
    • Fix Product Tax
    • Visual Swatch
    • Text Swatch

Note: If you use Dropdown and Multiple Select input types, do the following

Under Manage Options section, click Add Option button.

  • Select Default if you use the option as the default value.
  • If you have only one store view, let enter only the Admin value and it will be used for the storefront as well.
  • If you have multi store view, let enter one value for the Admin and a translation of the value for each store view.
  • Click on Add Option to create multi options that you want to include in the list.

Step7:After that In the Advanced Attribute Properties section, complete the following

  • Attribute Code — Enter a unique Attribute Code in lowercase characters, and without spaces.
  • Scope — Select one of the following to indicate where in your store hierarchy the attribute can be used.
    • Website
    • Store view
    • Global
  • Unique Value — Set to Yes if you want to prevent duplicate values from being entered
  • Add to Column Options — Set to Yes to add this attribute to the list of column options in the product grid.
  • Use in Filter Options — Set to “Yes” to add this attribute to the list of filter options in the product grid.

Step8:After that we will go on Manage Labels.

Enter a Title to be used as a label for the field. If your store is available in different languages, you can enter a translated title for each view.

Step9:Now we will go on Storefront properties.

  • Use in Search — Set to Yes if the attribute is to be available for search
  • Comparable on Storefront — Set to Yes if you want to use the attribute as a filter in layered navigation
  • Use in Search Results Layered Navigation — Set to Yes if you want to use the attribute in layered navigation on search results pages .
  • Position — Enter a number to indicate the relative position of the attribute in the layered navigation block
  • Use for Promo Rule Conditions — Set to Yes to use the attribute in price rules
  • Allow HTML Tags on — Frontend Set to Yes to allow the text to be formatted with HTML.
  • Visible on Catalog Pages on Storefront — Set to Yes to include the attribute in catalog page listings.
  • Used in Product Listing — Set to Yes to include the attribute in product listings.
  • Used for Sorting in Product Listing — Set to Yes to use attribute as a sort parameter for product listings.

Step10:When fill all the details then click Save Attribute button.

Your Attribute will show like this.

Step11:After that we will go on Admin sidebar.

Stores -> Attributes -> Attribute Set.

Step12: Now click on Add attribute set.

Step13:Now write your Attribute set name.

Step14:After that click on Save button.

Your attribute set will show like this.

Step15:After that click on Default attribute.

Step16:Now you’re Attribute set and your Attribute will show like below snap shot.

Step17:Now you can drag and drop if you want to show on filed like product details, content bundle item and image.

It will show like this below snap shot. And after that click on save button.

Your attribute is created.

Now you will see your attribute on product page.