Adding an attribute for the product is one of the important features of Magento 2 which allows a user to create and add an attribute to the products. You are allowed to create as many attributes as you need for a product in Magento 2 configuration. Each attribute will approve only one type of input that you will assign in the settings.
We can create a product attribute in two ways:
1.) Login to admin and then go to Catalog -> Product -> choose the product you want to add attribute -> click to add attribute button.
2.) Login to admin and then go to Stores -> Attributes -> Product.
For creating new product attribute we have to add different information in the form of different tab
There are three tabs in Attribute Information:
- Properties.
- Manage Labels.
- Storefront Properties.
# Now follow the below steps:
Properties :
- Attribute Properties
1.) Default Label: Add the name of the attribute, which use to identify it.
2.) Catalog input type for store owner: In this field, we can select any one input type for the attribute. There are many input types is there i.e.
If you select Multiple select or Dropdown, you have to configure another section
3.) Values required: Select yes/no. If a field is required select yes else no.
- Advanced Attribute Properties
4.) Attribute Code: Enter the attribute code without spaces and in lowercase.
5.) Scope: It includes Store View, Website, and Global. You will choose one of three places in your store system where the appearance of an attribute is approved.
6.) Default Value: With this, you can set a default value. When you create a product which has this attribute, it will give a default value for that product.
7.) Unique Value: Select yes, if you want the data saved in this attribute to be unique for each product.
8.) Input Validation for store owner: This field allows you to run a validity test of any data entered into the text field. You can set the validation to the attribute field as a decimal number, integer, e-mail URL, letters, and any alphanumeric values.
9.) Add to column options: Select yes if you want to add it in column option.
10.) Use in filter options: Select yes if you want to use in filter option.
Manage Labels.
11.) Default Titles: Add default titles for the attribute for different store view.
Storefront Properties.
12.) Use in search: select yes if you want the attribute should be searchable. And when you select yes you will get two more fields.
- Search weight: Add search weight i.e. in numbers like 1 or 2 or 3 etc.
- Visible in Advanced Search: Select if it should be searchable in Advance search.
13.) Comparable on Storefront: Select yes if you want to add the attribute in Product compare.
14.) Use in Layered Navigation: Select yes if the new attribute is using as a filter in layered navigation. This option is enabled when you select Multiple Select, Price field or Dropdown in Catalog Input Type for Store Owner.
15.) Use in Search Results Layered Navigation: When the attribute is going to in layered navigation on search results pages, set Yes. This option is enabled when you select Multiple Select, Price field or Dropdown in Catalog Input Type for Store Owner.
16.) Position: you can set the position of the attribute. . This option is enabled when you select Multiple Select, Price field or Dropdown in Catalog Input Type for Store Owner.
17.) Use for Promo Rule Conditions: If you select yes, you will be able to create promo rule conditions using attributes.
18.) Allow HTML Tags on Storefront: It means customers can text with HTML if you choose yes.
19.) Visible on Catalog Pages on Storefront: To make the attribute visible in catalog page listing, choose yes.
20.) Used in Product Listing: The new attribute is going to include in the product listing, If Yes.
21.) Used for Sorting in Product Listing: Use the attribute as the sort parameter for product listing.
After filling the above fields click on Save Attribute button to save the attribute
Please contact us at manish@bay20.com or call us at +91-8800519180 for any support related to Magento 2. You can also visit the Magento2 development page to check the services we offer.