Magento has always provided the level of sophistication for product attributes. Magento 2 is no different.
Before diving into the creation of products, you need to explore a very important -- and powerful -- feature of Magento 2: product attributes and attribute sets. Read on to become familiar with attributes and attribute sets in Magento 2:
- Why are product attributes so important?
- What is the role of attribute sets?
- How Magento 2 uses attributes to manage the information associated with products?
Magento 2 product attributes vs. attribute sets
Magento 2 uses attributes to manage the information associated with products. An attribute is a property of a product, for example, the product color, the size, or the description. Some attributes are built into the system by default, and others can be created to address specific needs. You can add, edit, or remove product attributes in Magento 2 to customize your products.
Attribute set represents a list of attributes that are related to a specific product family. After creating the attributes, we organize and group them into different attribute sets.
Each product has a unique DNA, thus you need different dedicated attribute sets specific to each product family. For example, shoes and cameras require different specific types of information -- shoes could have different colors, brands, and sizes, while a camera could have item weight, optical zoom, megapixels, screen size, iso range etc.,
That’s why one of the first steps when you create a product in Magento 2 is to choose the attribute set that is used as a template for the product record.
System attributes vs. custom attributes
Attributes that are built into the core Magento 2 platform are called “system attributes”, such as price, description, gallery, image, category_ids, price, sku, tier_price, weight etc.,
Even though you can add, edit or remove the attributes, you can’t remove the system attributes that are part of the core of Magento 2 catalog.
When viewing from the Admin | Stores | (Attributes) Product, you can see there are 46 system attributes (in default Magento 2.2.5). You should filter the grid by System: Yes, as shown in the screenshot below:
If you view product attributes under the Attribute Sets section -- Going to Stores | (Attributes) Attribute Set, then clicking on a specific Attribute Set, for instance ‘Default’ -- you should see the system attributes are marked with a red dot, as shown in the screenshot below:
These system attributes cannot be removed from the Groups list, however they can be dragged to another Group in the attribute set.
In contrary to the system attributes, you have full control to create, edit or remove as many custom attributes as you need to describe specific characteristics of your products in your catalog.
We will guide you through steps to create product attributes and attribute sets in the section below.
Why are Magento 2 product attributes so important and powerful?
Attributes are the building blocks of your Magento 2 product catalog. They not only describe the characteristics of a product, they are also used as search parameters, as criteria for layered navigation, product comparison, and price rules.
And that’s where Magento 2 product attributes and attribute sets really shine!
Let’s go through a few practical use case of attributes and attribute sets that essentially help you manage a diverse array of product data.
Showing additional information on product page
You can add a tabbed section with more information that catches your customers’ eye on the product page. Let’s take a look at a sample product Aeon Capri from our Crafts 2.0 theme, you can see four attributes listed under the More Information tab:
The attributes listed above are for demo purpose, however you can flexibly add any relevant attributes into the More Information tab that help your customers get a better understanding of your products.
Using in the Layered Navigation
Attributes can also be used to create the layered navigation that appears in the sidebar on your category pages.
For example, when a shopper chooses the Camera category from the top navigation, the initial results include all products in the category. With the help of the “Filter by Attribute” section of layered navigation, the list can be filtered further by choosing a specific Color, Screen Size, Focus Type, Megapixels, Optical Sensor Resolution, or price.
If you want to display the “Filter by Attribute” section of layered navigation on a category page, you need to enable Anchor under Display Settings section of such category. And when creating attributes for the layered navigation, please note you select one of these three catalog input types -- Dropdown, Multiple Select or Price that can be used as filterable attributes.
Using in Quick search and Advanced search
Magento 2 supports a Quick Search box in the upper-right corner, and a link to Advanced Search in the footer where shoppers can enter attributes as search criteria.
With the Quick search box, the search text can be the full or partial product name, or any other word or phrase that describes the product.
Advanced Search helps shoppers find products in your catalog based on multiple attributes entered into a form.
You can specify an attribute to be displayed in the Advanced Search form by setting the frontend properties of the attribute to “Include in Advanced Search”. As a best practice, you should include only the fields that your shoppers are most likely to use to find a product, for example -- product name, SKU, description, price, because having too many will slow down the search.
Adding attributes for product comparisons
Beside the roles as search criteria, filterable layered navigation, you can use attributes for comparison purposes.
Magento 2 lets your shoppers quickly compare the features of two or more products side by side. You can certainly add or remove attributes that you don’t want to include in the comparison report.
Using with price rules
Another powerful use case of attributes is with price rules for promotion purposes.
In Magento 2, attributes are used as a set of specific conditions for catalog and shopping cart price rules. Price rules can be set in advance that trigger actions when the required conditions are met, such as:
- Sending your best customers a coupon for a discount on a specific product
- Offering free shipping for purchases over a certain amount
- Scheduling a promotion for a period of time.
When navigating to your Admin | Marketing | (Promotions) Catalog Price Rules, then clicking on Add New Rule button, you should see Condition section similar to this screenshot:
For an attribute to appear in the list above, you must set the Use for Promo Rule Conditions to “Yes” (This setting is available under Storefront Properties tab of such attribute’s configuration panel).
Using for sorting in Product Listing
Product sorting is another area where attributes come in handy. If viewed from the Product Listing page, the sorting option will have default values -- Position, Product Name, and Price. You can customize these sorting option your way. For the attribute you want to use, set the Used in Product Listing to ‘Yes’.
How to create Magento 2 product attributes and attribute sets
Now that you have an overview about the essential roles of Magento 2 product attributes and attribute set. In the second part of this article, we will explain how to manage product attributes and attribute sets, so stay tuned!