How To Create Product Attributes In Magento 2 Admin Panel

Store administrators can create attributes while working on a product, or from the Product Attributes page. In this article, we describe a tutorial on how to create attributes from the Stores menu.

New Attribute Properties
New Attribute Properties

Step 1: Describe the Basic Properties

On the admin sidebar click Stores. Under Attributes click Product.

Click Add New Attribute

Attribute Properties
Attribute Properties

Input an Attribute Label to identify the attribute.

Set Catalog Input Type for Store Owner to the type in input control to be used for data entry.

For the Dropdown and Multiple Select input types, do these steps:

  • Under Manage Options, click Add Option.
  • Input the first value that you want to display first. You can enter one value for the admin, and a translation for each store view
  • For each option that you want to add to the list, repeat the previous step.
  • Select Is Default to use the option as the default value.

To force the customer to select an option before the product can be purchased, set Values Required to “Yes.”

Manage Options
Manage Options

Step 2: Describe the Advanced Properties (if needed)

Input Attribute Code in lowercase, no spaces.

Advanced Attribute Properties
Advanced Attribute Properties

Set Scope to select the place in your store hierarchy that the attribute can be used.

To avoid duplicate value, set Unique Value to “Yes”.

Set Input Validation for Store Owner to the data type that the field should contain to run a validity test of data. The test can validate any type of these information below:

  • Decimal Number
  • Integer Number
  • Email
  • URL
  • Letters
  • Letters (a-z, A-Z) or Numbers (0-9)
Input Validation
Input Validation

Set these options to “Yes” to add this attribute to the product grid,

Add to Column Options Includes the attribute as a column in the Products grid.
Use in Filter Options Adds a filter control to the column header in the Products grid.

Step 3: Enter the Field Label

Open the Manage titles tab, input the Title to be used as a label for the field.

Manage Titles
Manage Titles

Step 4: Describe the Storefront Properties

On the left of the panel, click Storefront Properties.

Set Use in Search to “Yes” if the attribute is to be available for search

Set Comparable on Storefront to “Yes” to include the attribute in Product Compare

Do these steps for the dropdown, multiple select and the price fields:

  • Set Use in Layered Navigation to “Yes” to use the attribute as a filter in layered navigation.
  • Set Use in Search Results Layered Navigation to “Yes” to use the attribute in layered navigation on the search results pages.
  • Enter a number in the Position field to indicate the relative position of the attribute in the layered navigation block.

Set Use for Promo Rule Conditions to “Yes” to use the attribute in price rules.

Set Allow HTML Tags on Frontend to “Yes” to allow the text to be formatted with HTML. This setting will enable the WYSIWYG for the field.

Set Visible on Catalog Pages on Storefront to “Yes” to include the attribute in catalog page listings

If your theme is supported, do these settings:

Set Visible on Catalog Pages on Storefront to “Yes” to include the attribute on the product detail page

Set Used in Product Listing to “Yes” to include the attribute in product listings

Set Used for Sorting in Product Listing to “Yes” to use the attribute as a sort parameter for product listings.

Click Save Attribute after completed.

Storefront Properties
Storefront Properties

Attributes for Configurable Products

Any attribute that is used as a drop-down options list for a configurable product must have the following properties:

Catalog Input Type for Store Owner Dropdown
Scope Global