How to Add a Product Attribute in Magento 2

The Most Popular Extension Builder for Magento 2

With a big catalog of 224+ extensions for your online store

Product Attribute is the characteristics of the products that your customers will consider to see if that item fits their needs or not, such as the size of a shirt or the color of a bag, etc. As a Magento 2 store owner, you should know how to add a Product Attribute in order to provide essential product information, classify items strategically, and speed up customers’ decision-making process. In this post, let’s find out what the product attribute is and how to add one. You can follow this how to add product attributes programmatically post as well.

What is the product attribute?

The attributes are the block of a product in a catalog, which enables customers to point to the existing characteristics of your product. You are allowed to create as many attributes as you need for a product in Magento 2 configuration. Each attribute will approve only one type of input that you will assign in the settings. Besides giving additional information about the product, the attributes are also used as search parameters and criteria to filter in layered navigation M2, product comparison reports, and promotions.

How to add a product attribute Add Attributes

The product attributes can be created from the Stores menu or the Product Detail page where you are working with the product.

How to add a product attribute Overview of Adding Attributes

Read how to update product attributes in bulk

5 Steps to Create a Product Attribute in Magento 2

Please follow all these steps with detailed guides to create a Product Attribute:

Step 1: Create a New Attribute

  • On the Admin Panel, Store > Attributes > Product, then click the Add New Attribute button.

How to add a product attribute create new Attribute

Step 2: Complete the Basic Properties

In this step, you are going to fill in the Basic Properties of a product attribute.

How to add a product attribute Basic Properties

  • Insert the Default Label to describe the attribute.
  • In the Catalog Input Type for Store Owner, choose the input type from the list.

  • Choose Yes for the Value Required to ask customers to select the options before purchasing.

Step 3: Complete the Advanced Properties (Optional)

The Advanced Properties include extra details of the attribute, so this step is optional.

  • Insert the Attribute Code that is less than 30 characters and excludes spaces.

How to add a product attribute Advanced Attribute Properties

  • The Scope includes Store View, Website, and Global.You will choose one of three places in your store system where the appearance of the attribute is approved.
  • Choose the suitable Default Value by clicking on the date you want.

Set Default Value

  • Apply the Unique Value if you do not want to share it with other products.
  • Select “Yes” in Add to Column Options to add this attribute to the list of column options in the product grid.
  • Select “Yes” in Use in Filter Options to add this attribute to the list of filter options in the product grid.

Step 4: Insert the Field Label

Adding a Field Label will help you find and manage the attributes more easily:

  • Open the Manage Labels section.
  • Insert the Title that is shown for the field label. In case of multiple languages supported on your store, insert the translation of the title for each view.

How to add a product attribute Manage Title

Step 5: Complete the Storefront Properties

Now, you need to set up the details in Storefront Properties to decide how the attribute is shown in the frontend:

  • Look down the Storefront Properties.

How to add a product attribute Storefront Properties

  • Choose Yes for the Use in Search to be ready for searching the attribute. Then, fill out the Search Weight and Visible in the Advanced Search fields.
  • Allow comparing the product attributes in Product Compare if you choose Yes in the Comparable on Storefront field.
  • If the catalog input field is Dropdown, Multiple Select, or Price, you can do the following:
    • Allow filtering the attribute in the Layered Navigation if you set Yes for the Use in Layered Navigation.
    • Show the attribute in layered navigation on the search result page if you set Yes for Use in Search Results Layered Navigation.
    • Set the Position of the attribute in the layered navigation block.
  • Choose Yes in the Use for Promo Rule Conditions field to apply the product attribute for the price rules.
  • To make the attribute visible in the catalog page listing, choose Yes in the Visible on Catalog Pages on Storefront field.
  • If Product Listing is supported at your store, the attribute can appear and be used as a sort parameter. Configuring that from the Used in Product Listing and Used for Sorting in Product Listing field.
  • Save Attribute to finish all.

Check this product filtering solution - Layered Navigation now!

Input Type Description

In the settings process of creating the new product attribute, there are many input types you need to assign directly to the attribute fields, such as Text Field, Dropdown, or Yes/No. The input types will specify the type of data that is inserted into the fields, the format of the fields, and input control. All attribute fields take a responsibility to give more details about your products, and it is required for the customers to complete them before purchasing if needed.

  • Text Field: The field supports text type with only one line.
  • Text Area: The text area is the text field with multiple lines in it. It allows a paragraph such as a product description. For the text area, the WYSIWYG Editor is available to format with HTML tags or insert tags directly into the text.
  • Date: The Date value can be entered directly or selected from the dropdown list or clicked on the Calendar icon, depending on your purpose.
  • Yes/No: The field includes 2 options: Yes and No in the dropdown.
  • Dropdown: Dropdown allows listing all values for the field at the same time and accepts only one value.
  • Multiple Select: Many values will be accepted at the same time in the field. All values appear in the dropdown.
  • Price: Price value is set for the price field of the product. You can also use the Price value for the Special Price, Tier Price, or Cost field. The currency is based on your configuration.
  • Media Image: The images of the attribute in the Media Image field will link to an additional image of the product with Base, Small, and Thumbnail, although the thumbnail gallery will not include the media image.
  • Fixed Product Tax: Give the fixed number for the FPT rate.
  • Visual Swatch: The visual swatches can describe the true color, texture, or pattern with a hexadecimal color value or an image.
  • Text Swatch: A text swatch is like a button that is used for an attribute value as size.

The bottom line

Product attributes play an essential role in how you manage your inventories and how customers can navigate the product search process. That is why this tutorial on how to add product attributes in Magento 2 will be helpful for online stores like yours.

Additionally, for ongoing smooth operations, it’s essential to consider our Magento maintenance service to ensure your store’s stability and performance.

Related Post

Discover how to create Product Attribute Sets in Magento 2

Looking for
Customization & Development Services?

8+ years of experiences in e-commerce & Magento has prepared us for any challenges, so that we can lead you to your success.

Get free consultant
development service
  • magento-2-tutorial

  • how-to

  • create

  • product

  • attribute

Explore Our Products:

People also searched for


Stay in the know

Get special offers on the latest news from Mageplaza.

Earn $10 in reward now!

Earn $10 in reward now!

go up