Magento 2 Product Attributes
Product attributes describe specific characteristics. Moreover, they provide additional information for your website, determine the input type used for product options and also are used as search parameters for layered navigation.
There are two types of attributes used by Magento:
Default or system attributes are required for the proper functioning of a store and hence, can never be deleted. You can find the list of 70+ default attributes (including name, price, URL, SKU, descriptions, images, etc.) in the Stores - Attributes - Product section.
Custom attributes are created by the store admin. You can add any number of attributes to this section.
How to Create a Custom Product Attribute
Step 1: Properties Section
To create a new attribute, go to Stores - Attributes - Product and hit the 'Add New Attribute' button. Fill in the 'Basic' and 'Advanced' properties information.
In the 'Default Label' section, specify a label to identify the attribute. In the 'Catalog Input Type for Store Owner', choose one of the available types:
- Text field is a field with a single line for the text such as name, SKU etc.
- Text area can include a larger amount of text data like description and explanation.
- Date can be used as an attribute and can either be directly typed in the field or can be input through the calendar.
- Price is the system configuration that determines the currency.
- Media image contains a thumbnail, a small image and a base image. More images can also be input.
- Visual swatch allows showing colors, patterns or textures of an attribute.
- Text swatch shows the text for an attribute, if the image isn't available.
- Fixed product tax allows you to add a fixed amount of money as a tax.
Please note! If you select a 'Dropdown', 'Multiselect' or 'Visual/Text Swatch' types, you will see a 'Manage Options/Swatch' section:
Advanced Attributes Properties allows you to manage and customize the following settings:
Attribute code. Enter a unique attribute code that will help you identify the attribute.(Internal use only)
Scope allows you to display the attribute using one of the pre-defined positions:
Store View will show different values for various languages. Global will have the same value throughout the system. Website applies to the entire website, including all store views.
Creation of duplicate values is prevented by the Unique Value. This is helpful for attributes such as Stock Keeping Units, where a separate value is required for each SKU.
The Input Validation for a Store Owner allows the following data to be incorporated and is applicable only for the text input type.
- Integer number
- Decimal number
- Letters or numbers
Step 2: Manage Labels
If your store is available in several languages, you can enter a translated title of an attribute for each store view in the 'Manage Labels' section.
Step 3: Storefront Properties
In this section you can specify how the attribute can be used in sorting, search, compatibility of products, price rules and layered navigation.
- Use in Search makes the attribute available for search.
- Comparable on Storefront includes the attribute in the 'Product Compare'.
- Use in Layered Navigation can show an attribute as a filter in Layered Navigation.
- Use in Search Results Layered Navigation lets you show the attribute in LN on search results page.
- Use for Propmo Rule Conditions uses an attribute in price rules.
- Allow HTML tags on Storefront allows the text to be formated with HTML.
- Visible on Catalog Pages on Storefront includes the attribute into the catalog listings.
- in product Listing includes the attribute into the product listings.
- Used for Sorting in product Listing allows using an attribute as a sort parameter for product listings.
When done, hit the 'Save Attribute' button.