Although the Magento 2 store already has some attributes to be applied to the products, store-owner can choose the way to create more attributes during working on a product. It’s an interesting opportunity to create new custom attributes to make the products be more attractive to customers
Related tutorial: How to load products by attribute (SKU) or id in Magento
This Magento 2 tutorial will guide you through the process to create and manage new attributes for products in Magento 2.
In this step, we will compete Basic and Advanced Properties information:
Login to the back end of Magento 2.
Form the Admin sidebar, navigate to Stores > Attributes > Product.
At this section, you will see the list of all the available attributes to the store. You can edit them there to your front end and add new attributes.
Click the Add New Attribute orange button on the upper right corner to start.
Explore the Attribute Properties section.
- In the Default label, enter the default label to identify the attribute.
- In the section of Catalog Input Type for Store Owner, select the type in input control to be used for data entry: Text Field, Text Area, Date, Yes/No, Multiple Select, Dropdown, Price, Media Image, Fix Product tax, Visual Swatch, Text Swatch.
For example, we choose Dropdown and Multiple Select input types.
Click Add Option in Manage Options.
- Select Default if you use the option as the default value.
- If you have only one store, enter the Admin value only and it will be used for the store front end.
- If you have multiple stores, enter one value for the Admin and translate the value for each store view.
If you want to create multi options, continue to Add Option.
In the section of Value Required, if you want to require the customers to choose among options before purchasing, select Yes.
In the section of Advanced Attribute Properties:
- Enter an Attribute code in lowercase characters without space to Attribute Code section.
- Select one of the scopes in the Scope section to indicate your store hierarchy that the attribute can be used:
* In the `Unique Value` field, set to `Yes` if you want to prevent duplicate values from being entered
* In the `Add to Column Options` field, set to `Yes` to add this attribute to the list of column options in the product grid.
* In the `Use in Filter Options` field, set to "Yes" to add this attribute to the list of filter options in the product grid.
In this step, we will manage the labels:
In the Manage Labels section, enter the Title to be used as label for the field. You can also enter a translated title for each view.
In this step, will describe the Storefront Properties
Explore the section of Storefront Properties:
- In the section of Use in Search, select Yes if the attribute is available for searching.
- In the section of Comparable on Storefront, select Yes if you want to include the attribute in Product Compare.
- In the section of Use in Layered navigation, select Yes if you want to use the attribute as the filter in layered navigation.
- In the section of Use in Search Results Layered Navigation, select Yes if you want to use the attribute in the filter in layered navigation on search result pages.
- In the section of Position, enter the number to determine the relative position of the attribute in the layered navigation block.
- In the section of Use for Promo Rule Conditions, select Yes to use the attribute in price rules.
- In the section of Allow HTML Tags on Frontend, select Yes to allow the text to be formatted with HTML.
- In the section of Visible on Catalog Pages on Storefront, select Yes to include the attribute in catalog page listings.
- In the section of Used in Product Listing, select Yes to include the attribute in catalog page listings.
- In the section of Used for Sorting in Product Listing, select Yes to use attributes as a sort parameter for product listings.
Click Save Attribute to save all the procedure.
In this step, we will apply the new attribute to the product.
In the Admin side bar, navigate to Products > Catalog.
Click Add Product to add new one or edit the currently existing products.
Click on the Add Attribute tab on the right corner to add the new Attribute to the products.
Choose the Attribute from the drop down to add.
That’s come to the end of the tutorial. If you have further inquiry toward this topic, please help us with your comments.