What is an attribute and attribute set, and what are they for?
In one of our previous articles, we covered the process of product creation in Magento 2. Choosing the attribute set is one of the first steps in the process of creating a product, so it would make the most sense to learn about attributes and attribute sets, and how to create and configure them in Magento 2. Let’s take a closer look.
In order to understand the concept of an attribute and an attribute set, let’s use an example: a bag. A bag can be described by a large number of characteristics such as: color, material, weight, size, etc. All of these characteristics put together describe an attribute set (quite literally a set of characteristics) and each of them individually is an attribute (or individual characteristic) of the product.
Attributes in general serve a few purposes: they can be used as search parameters and criteria for layered navigation (aka faceted filters), they can play a part in product comparison reports to help a customer distinguish one from another, and they can help define products during times of promotions.
By default, Magento has a list of system attributes (such as price, weight, size etc.) that you can use for your products, but if you need more properties to describe and filter products in your catalog, you can create as many attributes as you need. Overall, this helps your customer have the best experience possible when shopping at your store.
Planning Attributes and Attribute Sets
Once the attribute set for a specific product has been assigned, you won’t be able to change it. The only way out: create the same product but with another attribute set and remove the previous (duplicated) product. That’s why, it is so important to think about what attributes and attribute sets you’ll want to assign your products ahead of time, before you start adding products.
To create the product “bag”, you most likely won’t need to create a special attribute set just to do so. There are enough attributes in the Magento default attribute set (color, price, country of manufacture, description, gallery, price, sku, visibility, weight etc.) that should describe all the product attributes you would need to properly list this product. But, in the event you do need a little something extra (something like material, pattern etc.), it would be a better idea to create a completely new attribute set that is more tailored to your specific product needs.
While planning the attribute set for your product, you should also take into account some other basic criteria:
- If your site sells several types of goods and each type has differences in parameters, it makes the most sense for each type to have its own attribute set. This way, each product can be best represented on your store as possible.
- Get to know and become familiar with the default attributes, this could save you a lot of time and energy in the long run if each product type doesn’t need to have it’s own custom template.
- When creating attributes, it is important to select the correct attribute type from the drop down, to make your life easier throughout the rest of the process (text, dropdown).
- Text attributes do not impact layered navigation or configurable products so these values must come from a dropdown if you want those attributes to be displayed.
- The fewer number of attributes created, the smaller the database will be in the end, which also means the site will run faster.
- Separate attributes into tabs and create separate sections if necessary. This helps speed up the work of content managers.
Ways of adding attributes in Magento 2
Magento 2 enables you to add product attributes in two distinct ways. Let’s take a closer look at our first option here:
1. Creating a custom attribute.
Creating an attribute in Magento 2 consists of the following steps:
1. Go to Stores and select “Product” in the admin panel
2. Then select “Add New Attribute”
3. Choose some attribute properties:
– Default Label: The label that identifies the attribute during data entry. For example, “Country of Manufacturer”, “Weight” etc.
– Catalog Input Type for Store Owner: Determines the data type and input control that is used to manage the product from the store Admin. For example, text, multi-select etc.
– Values Required: A required value needs to be entered in this field before the record can be saved. Set Values Required to “Yes.” (Options include Yes and No)
4. Choose advanced attribute properties if needed (Attribute Code, Scope, Default Value etc.)
5. Choose storefront properties
6. Save Attribute
Now that we’ve created the necessary attributes that will be added to the attribute set, we just need to highlight the products that this will be applied to. We can do that next, in the following steps:
- Go to Stores and select Attribute Set
- Open the necessary Attribute Set
3. Transfer your newly created attribute from ‘Unassigned Attributes’ column to ‘Groups’
4. Click ‘SAVE’ and you’re good to go.
In addition to creating custom attributes for your more unique and specific products, we can also make attribute lists from pre-existing attributes (or characteristics). Let’s take a closer look at how we can do that.
2. Choosing from the list of existing Attributes.
Note: The following steps are not completely functional at the time of publication of this article. We’re going to walk through the process anyway, as everything should go as planned in future releases. However, if you don’t want to wait for this feature to become functionally available, you can always reach out to one of our Magento developers and they’ll gladly assist you in fixing this feature.
Attributes can be selected and modified while actively working on a product, and in the following example, we’ll see how to add any attribute to a product from the list of existing options.
Step 1: Open the product in the admin panel
Step 2: Click ‘Add Attribute’
Step 3: Choose an attribute from the list and select ‘Add Selected’
Step 4: Save the product
As we already mentioned, choosing the attribute set is one of the very first steps when creating a product and can also be used as a template for the product record. If you sell products that require specific types of information, such as cameras, it might be better to create a dedicated Attribute set that includes the specific attributes that are needed to describe each product (camera, watch, shoe, etc).
Steps for creating an Attribute set:
1. From the Admin sidebar, select Stores, then under Attributes, select Attribute Set.
2. Click ‘Add New Set’ and then do the following:
a. Enter a Name for the Attribute set (the name is completely up to you, as this is the part where you’re customizing your own Attribute set)
b. Set “Based On” to an existing Attribute set to be used as a template.
c. Click Save.
The next page will then display the following information:
- The left column shows the name of the Attribute set we’ve just created. The name is for internal reference, and can be changed at any time as needed.
- The center of the page lists the current selection of attribute groups.
- The right column lists the selection of attributes that are currently not assigned to the Attribute set.
- To add a new attribute to the set, click and drag the attribute from the “Unassigned Attributes” list to the appropriate folder in the Groups column.
- When complete, select Save.
To create a new attribute group:
1. In the Groups column, select the attribute set and click Add New.
2. Enter a Name for the new group (again, completely up to you as this is fully customizable) and click OK.
3. Do either of the following:
- Drag Unassigned Attributes to the new group.
- Drag attributes from any other group, to the new one.
The new group you’ve just created now becomes a section of attributes that can be applied to any product that fits the overall category of this Attribute Set. After just a few simple clicks, we’ve created a custom template for our store products that help increase visibility to our customers.
As usual, if any of this information seems a bit too intense or complicated, don’t hesitate to reach out to our Magento developers, or one of your project managers for more help and/or clarification. We’re here to make things easier, so don’t settle for something that isn’t working 100% for you and your store.
Subscribeto our newsletter
All You Need to Know about Magento Shipping and Extensions21 Sep 2021The selection of shipping methods and shipping providers is of great importance for your store. Magento supports a wide range of shipping methods and carriers.
Top 5 Magento Stores Examples & Magento 2 Demo Store [Bonus]13 Sep 2021If you wonder who uses Magento, keep reading our selection of five Magento online stores with an overview of features their customers are fond of.
Magento Multi-Store Functionality Explained with Examples & Tips10 Sep 2021In case you have more than one shop, you’re definitely aware of a range of challenges related to developing and maintaining several sites — time, effort, money.