How to Add Attributes in Magento 2.0

In this tutorial we will illustrate how you can setup your products’ attributes. Attributes are an important part of your product catalog as each of them can help potential customers with choosing a certain product that corresponds to their needs. Users will also be able to search and compare products based on their attributes.

Your Magento 2 store includes predefined attributes such as Name, Price, and Description, that can be used for any product. In addition to these, you can create new custom attributes to help your clients with their choice.


To create a new attribute login to your website’s admin dashboard and navigate to the Stores>Attributes>Product section of Store


Accessing the Products Attributes menu in Magento 2

In Magento 2.0 you can add attributes with 9 different input types for store owner:

  • Text Field
  • Text Area
  • Date
  • Yes/No
  • Multiple Select
  • Dropdown
  • Price
  • Media Image
  • Fixed Product Tax

This will open the list of all attributes currently available on store. To create a new one click on the big orange Add New Attribute button.


Preparing to Add a New Attributes


Now you will be able to configure the attribute.


Configuring the Attribute properties


For the purpose of this tutorial we will configure a “Size” attribute which will require multiple selections from the different sizes.

Managing the Option Values of your Attribute


In the Advanced Attribute Properties you can setup:


  • Attribute Code – The name of the attribute that will be used by the system
  • Scope – allows you to declare the attribute value saving scope like
  • Website - the value of this attribute for a product can be different in different Websites but have to stay the same between Store Views contained under the same Website.

Store View - the value of this attribute for a product can be different in all Websites and all Store Views

Website - the value of this attribute for a product can be different in different Websites but have to stay the same between Store Views contained under the same Website

Global - the value of this attribute for a product must be the same for all websites and stores


Configuring the Advanced Attribute Properties


Admin table is only seen to Store Owner.

If the value is required (and it is required in our case, you cannot sell a camera without letting the customer know about such attribute as zoom), we select “Yes”.

We can also manage Advanced Attribute Properties and Manage titles and change Storefront Properties.

  • Unique Value – Set this to Yes, if you want the data saved in this attribute to be unique for each product. If you have different products made of the same material or having the same feature, leave this to No
  • Input Validation for Store Owner – If you want to validate the data before applying changes to the attribute, select Yes
  • Add to Column Options – To add this attribute to the list of column options please select Yes
  • Use in Filter Options – If you set this to Yes the attribute will be added to the list of filter options

From the menu on the left, click on the Storefront Properties tab to configure the frontend behavior of the attribute.


Configuring the Storefront Properties of your Attribute


 To save your new attribute click on the Save Attribute button on the top right corner of your screen. This will bring you back to the attributes list page on which you should see your new attribute.


Advanced Attribute Properties

Let’s take a look at some of Advanced Attribute Properties that we can manage in Magento 2.0.

Attribute Code. We can enter a unique attribute code that will help to identify the attribute internally. Note that we can only use lowercase letters and no spaces.

Scope. We use it to select where we want to display our Attribute: on our website or globally.

Default Value. We can input the default value, but this is not applicable to all Input types for Store Owner. In the case of Dropdown menu we cannot select a default value.

Unique Value. If you would like your attribute to be applicable to only one product, you select “Yes”. If you would like it to be applicable to all products on your store, you select “No”.

So, we selected everything that we needed. After that we can Manage Titles. Here we can change the name of the attribute that will be displayed on the store.

In Storefront Properties you can select whether you would like to use the attribute in search, layered navigation, product listing and make other changes if necessary.

You can see how our new Attribute is displayed in the Product Details page after all settings are done.

Viewed 796 Times

Post On 2022-11-28