
Magento 2 product attributes are the properties of the product that help customers filter through the product variations and find the items they need. This correspondingly influences their experience with your store and helps to make a purchasing decision.
In Magento, you can use built-in product attributes or add custom ones. However, when you create product attributes in Magento 2 you can get quite overwhelmed due to many options. But not any more.
Today, you'll learn everything you need to know about Magento 2 product attributes, how to create, use and edit them using the Magento 2 mass actions.
What are Magento Product Attributes?
Magento product attributes are certain characteristics of a product in your store. They provide detailed information about a product and serve as criteria for advanced search, product comparison, layered navigation and promotions.
You can create multiple product attributes in Magento. There is no limit. However, each attribute will have only one input type you will assign in the settings.
Examples of Product Attributes in Magento
Magento already has a set of product attributes by default. Although you can edit them, you can delete them. Some of the common ones include:
- SKU —the unique stock-keeping unit used to identify a product.
- Weight — product weight.
- Visibility — defines on which website a product should be available.
- Status — specified if the product is enabled or disabled.
Nevertheless, you can create any other product attribute, like size or colour, to extend the product characteristics.
How to Use Magento 2 Product Attributes?
Before we jump to the main section of the page on how to create Magento 2 product attributes, let's review how you can use them in your store.
As you might already know, a lot of features in Magento are linked to rules and conditions. These conditions, correspondingly, are based on the product attributes to narrow down the options.
Cart and Catalog Price Rules
If you want to provide discounts for the entire catalogue or only some specific products in the shopping cart, you use these two types of rules. Both allow you to choose what product attributes to define what products to apply the discount to.
You can use the system attributes and any custom product attribute for this.
Related Product Rules
To automate your related products, cross-sells, and up-sells you need related product rules. Here product attributes are used in two different ways — you define what product pages to display the related products block and then what product to display on these pages.
e.g. you choose to display only New products from the Men > Tops category on the Men category.
Dynamic Category Rules
Adding products to categories takes a while if you have an extensive catalogue. But only in case you don't use dynamic category rules. They help you create categories and add/remove products from them automatically. All that using product attributes.
Therefore you can create categories with discounted products, products with the highest rating or products purchased the most in the last month.
How to Create Product Attributes in Magento 2?
To make the most of the rules we've mentioned above you need to create custom product attributes in Magento.
To create product attributes in Magento 2 go to Admin Panel > Stores > Attributes > Product and press the Add New Attribute button.
1. Fill out the Attribute Properties
- Enter a Default Label. It will be displayed on the admin panel.
- Choose a type of product attribute in the Catalog Input Type for Store Owner field. There are such available values here: Text Field, Text Area, Date, Yes/No, Mutli Select, Dropdown, Price, Media Image, Fixed Product Tax, Visual Swatch,Text Swatch.
- Select Yes in the Values Required field to make the attribute required for products. In this case, you won't be able to save a product unless you set an attribute value.
2. Fill out the Advanced Attribute Properties
- Set the Attribute Code. If you leave this field empty, the attribute code will automatically be generated from the default label.
- Choose a level on which your attribute can be edited in the Scope field.
Note: if you create a text field attribute and have a multi-language store, it's best to keep it at the Store view level. In case the attribute value doesn't depend on the website or language choose Global.
- Set a Default Value of an attribute. Note that its value won't be automatically set for all existing products. It will be added only after you resave a product.
- Set Yes in the Unique Value field, if you don't want the same attribute value to be applied to different products, e.g. SKU attribute should be unique.
- Set filter that will be used before saving a product to validate an attribute value in the Input Validation for Store Owner select box.
- Set Yes for the Add to Column Options option to add a product attribute to the Product Grid Columns.
- Choose Yes in Use in Filter Options field if you want your attribute to be used while filtering products.
3. Manage Lables
Set a Default Store View which will be displayed on the frontend in the Manage Labels section. In case you have a multilingual site, you can set a label for each language.
4. Configure the Storefront Properties
- If you want the attribute to be used in the catalog search, choose Yes in the Use in Search field and set the Search Weight.
- Decide whether you want the attribute to be Visible in Advanced Search.
- In the Comparable on Storefront field you can select whether this attribute will be used on the compare product page.
- Choose how you want the attribute to be used in layered navigation in the Used in Layered Navigation.
- Choose whether the attribute will be used in layered navigation search in the Use in Search Results Layered Navigation.
- Set the Position of the attribute in the layered navigation.
- Choose Yes in the Use for Promo Rule Conditions field if you want this attribute to be used in rule conditions for the rules we've mentioned above.
- Choose Yes in the Visible on Catalog Pages on Storefront to make the attribute displayed on a product page in additional options.
- Choose Yes in Use in Product Listing to add this attribute value to the PHP product object in a product list (product collection).
- Choose Yes in the Used for Sorting in Product Listing if you want the attribute to be used for the sorting process.
Don't forget to press the Save Attribute button once you finish and move to the next stage.
Add Product Attribute to Magento Attribute Sets
For the attribute you've created to appear on the product editing page, you first need to assign it to the attribute set. It is a group of attributes characteristic of a certain type of product.
e.g. apparel attribute set could contain attributes like colour, weather, and material while the downloadable product — file size, file type and software compatibility.
To assign a Magento product attribute to an attribute set go to Admin Panel > Stores > Attributes > Attribute Set.
Then choose the attribute you need, drag and drop it from the Unassigned Attributes to Groups and Save it.
How to Edit Magento Product Attributes in Bulk?
Although Magento product attributes help you keep product information structured and easy to find, editing them is quite challenging. Thus, if you want to change the price of a few products, you need to go to each product to edit the value. Not unless you know how to edit product attributes in bulk, from the product grid.
In this case, you only need to tick all the products you want to edit, change the attribute value and press Apply.
Not only does this save you tons of time, but makes product management way easier for you and your store managers. So, if you want to know how you can facilitate plenty of other product-related tasks in your store, check Magento 2 Extended Product Grid Extension.