Understanding Magento 2 Product Attributes and Attribute Sets

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

Product attributes
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 sets
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:

Magento 2 product attributes - System attributes

Magento 2 System attributes

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:

Magento 2 product attributes - System attributes under attribute set

System attributes under Attribute Set section

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:

Magento 2 product attributes - Showing additional info on product page

Showing additional info on product page

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.

Magento 2 product attributes - Filterable attributes for layered navigation

Filterable attributes for layered navigation

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.

Magento 2 product attributes - Quick search box

Quick search box on Magento 2 theme -- Crafts 2.0

Advanced Search helps shoppers find products in your catalog based on multiple attributes entered into a form.

Magento 2 product attributes - Quick search box

Advanced search link on Magento 2 theme -- Crafts 2.0

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.

Magento 2 product attributes - Add to Compare

Add to Compare on Magento 2 theme -- UB Bookshop

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:

Magento 2 product attributes - Attributes used with Price rules

Attributes are used as a variety of conditions in price rules

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’.

Magento 2 product attributes - Sorting by Attributes

Sorting products by attributes on Product Listing page

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!

Got questions about Magento 2 extensions or themes? Talk to Ubertheme, we’re happy to help.

Written By

Comments