was successfully added to your cart.

How to Create Attributes in Magento 2?

How to create attributes

Product attributes are characteristics based on which customers can pin down the exact product they want to buy. For example, product name, price, SKU, size, color, and manufacturer are a few types of attributes. Knowing how to add and manage attributes is fundamental to running an e-commerce business. This tutorial teaches how to create attributes in Magento 2.

To start adding attributes you must know the types of product attributes – System attributes and Simple attributes.

System attributes are the ones which are generated by Magento, e.g., product name, price, SKU etc. Without such basic product characteristics, a Magento store cannot identify one product from another.

Simple attributes are the ones which are added by the store owner. Product size, color, and manufacturer details are examples of simple attributes.

 

Follow these simple steps to create Attributes in Magento 2

Process Overview:

STEP 1: Add a New Attribute

STEP 2: Describe the Basic Properties

STEP 3: Describe the Advanced Properties

STEP 4: Enter the Field Label

STEP 5: Describe the Storefront Properties

 

STEP 1: Add a New Attribute

  • From Admin panel, go to Store and click Product under Attributes.
  • Click Add New Attribute button on the top right part of Product Attributes page.Product-attributes-1024x470

 

Quick Tip 1: If you want to make changes to an existing attribute, click on the attribute to open the Edit Attribute page.

 

STEP 2: Describe the Basic Properties

New-Product-Attribute-1024x509

 

  • Fill in the Default Label. You’ll be able to identify attribute through this label.
  • Select input type from the drop down list for Catalog Input Type for Store Owner. Following are the settings under this list:Catalog-Input-Types Each catalog input type has its own uses. For example, when you want to add a color attribute, you want a dropdown list. Dropdown lists are definitive and there is no room for error, like putting in different values such as red or magenta for shades. For text, you want to use a free form text field. For an image attribute, you want a field where you can upload a product picture.

 

Quick Tip 2: You can drag-and-drop the values in Dropdown lists to rearrange the attribute values according to your preference.

Position-Attributes-in-Drop-down-1-1024x503

 

  • Set Values Required field as Yes/No, according to the attribute type you’re adding. If you set it as “Yes”, you won’t be able to save a product with this attribute unless you specify the attribute value.

 

STEP 3: Describe the Advanced Properties

Advanced-Attribute-Settings

 

  • Fill in the Attribute Code. Attribute code is used internally to manage the attribute. Customers never see this code.
  • Specify Scope of the attribute – whether it will be applicable at Store View, Website or Global level. This setting becomes useful when you have more than one store or website running on a single Magento installation.
  • Set Unique Value to Yes/No. If you’ve set this value to “Yes”, only one product in the whole store will be able to have the same value for this attribute.
  • Input Validation for Store Owner is a data validation setting. When this is setup, Magento checks and warns whether the correct type of data has been input for the attribute or not.

 

STEP 4: Enter the Field Label

Add-field-label-1024x509

 

Add attribute titles in Manage Labels. This is useful when you have a multi language store. As the demo is only for English, there is only Default Store View label displayed. Magento automatically shows more Label fields for different languages for you.

 

STEP 5: Describe the Storefront Properties

Add-Storefront-Properties-1024x750

 

  • Set Use in Search to “Yes” if you want the attribute to be available for search.
  • Set Comparable on Storefront to “Yes” if you want the attribute to be used to compare products when a customer chooses to compare items. This attribute will be compared for the products and shown in results.
  • Set Use in Layered Navigation to “Yes” if you want your customer to use this attribute to filter products in Magento’s layered navigation. This setting is only available if the “Catalog Input Type” selected in Step 2 is Dropdown, Multiple Select or Price.
  • Set Use in Search Results Layered Navigation to “Yes” if you want the attribute to be used as a filter in layered navigation on the store’s search result page. This setting is only available if Layered Navigation is enabled for this attribute.
  • Set Position of the attribute to be shown in Layered Navigation. Enter “1” if you want the attribute to be at the top. This setting is only available if Layered Navigation is enabled for this attribute.
  • Set Use for Promo Rule Conditions to “Yes” if you want the attribute to be used in price rules.
  • Set Allow HTML Tags on Frontend to “Yes” if you want to allow text to be formatted using HTML.
  • Set Visible on Catalog Pages on Storefront to “Yes” if you want the attribute to be included in catalog page listings. This setting is only available if the attribute added is “Simple Attribute”. When this setting is set to “Yes”, this attribute will be shown in the Additional Information section under the product description.
  • Set Used in Product Listing to “Yes” if you want the attribute to be included in product listings.
  • Set Used for Sorting in Product Listing to “Yes” if you want the attribute to be used for sorting in product listings.Save-Attribute-1024x470

 

Once you’ve completed all the steps, click Save Attribute on the top right corner of the page. 

You’ll see the following message pop-up when the attribute is saved. 

Popup-Message-1024x527

 

This is to alert you that a re-indexing is needed for the database. Magento 2 indexes product and category data to increase store performance. When there is a change in data, like adding a new attribute, you need to reindex to update the information in the database as well.

And voila! That’s all there is to create attributes in Magento 2.