How to create Product Attributes in Magento 2?
Attributes are an essential part of our product catalog because each product attribute helps the customers to choose certain products corresponding to their needs. The user will be able to search and compare the products with other products based on their attributes.
Magento 2 store already has some predefined attributes such as Name, Price, and Description. Apart from these, we can also create new custom attributes to enhance the product information, and help the customer with their choice. The additional attributes of any products are like color, size, etc.
The store owner can create the Attribute either during working on a product or from the Product Attribute page. The product attribute can also be created from the Store menu or from the Product Detail Page, where we work on a product. Below some set of instructions are given through which we will learn how to create product attributes in Magento 2.
How to add a product attribute?
Step 1: Login to the Magento 2 Admin Panel. On the left sidebar of the Magento 2 dashboard, click on Stores. Select Product inside the Attribute section, i.e., Stores >> Product.
Step 2: On the Product attribute dashboard, click on Add New Attribute.
Step 3: Fill the required information in the given fields.
There are three sections, in which we need to set up the Product Attribute information. These sections are Properties, Manage Labels, and Storefront Properties.
Properties: This section includes both basic and advanced properties of attributes.
Manage Labels: Label identifies an attribute in the admin as well as in the storefront of each store view. We can enter a different translated label for each language if our store is available in multiple languages.
Storefront Properties: The Storefront properties tab determines how an attribute can be used in our store, its behavior, and appearance. We can specify whether attributes are available for search, product comparisons, layered navigation, rules, price, and sorting. For text attribute, we can enable the WYSIWYG editor, and determine if the HTML tags can be used to format the values.
Now, we will discuss each section individually in detail.
Step 1: Complete the basic and advance properties information
In the Attribute Properties do the following:
- In the Default Label field, enter a label that identifies the attribute during the data entry.
- In the Catalog Input Type for Store Owner, choose the type in input control that is to be used for data entry, such as Text field, Text Area, Date, Yes/No, Multiple stores, Drop-down, etc.
- In the Values Required field, select Yes if we want to require the customers to choose an option before they can buy products.
Click on Add Option button under the Manage Options section, and add the different options to the customer to choose.
Mark the Is Default checkbox, if you want to use it as a default value.
If we have only one store view, then enter only Admin value, which will be used for the storefront as well.
Advanced Attribute Properties
- An Attribute Code is a unique identifier for internal use that must be less than 30 characters, excluding space. It must begin with a letter but also can include a combination of lowercase letters (a to z) and numbers (0 to 9).
- The Scope field limits the use of an attribute to a specific store view or website.
- Set Yes in the Unique Value field to prevent the duplicate values from being entered.
- In the Add to Column Options field, set to Yes to add this attribute to the list of column options in the product grid.
- In the use in Filter Options field, set Yes to add this attribute to the list of filter options in the product grid.
Step 2: Manage Labels
- Tap on the Manage Label section to open it and do the following.
- Insert the Title, which is shown for the Label field. In case if your store supports multiple languages, then insert the translation of the title for each view.
Step 3:Complete the Storefront Properties
- Click on the Storefront Properties section to open it and fill the required information in the given fields.