Magento 2 Product Attributes

Magento 2 Product Attributes – Know Clearly to Use Properly

by Stephanie Greene

For e-commerce businesses, product attributes are crucial to providing customers with the most detailed information on your products. Each aspect that makes a particular product unique should be specified as an attribute for better filtering, searching, and comparing. To improve the shopping experience in your store, you need to explore this very important and powerful product attributes feature of Magento 2.

In this article, we will guide you through everything you need to know about Magento 2 Product Attributes.

What are Magento 2 Product Attributes?

Magento 2 attributes are the materials to build the product characteristics so that customers can find and buy your products. On the other hand, attributes are used to manage products in the backend. Mostly, Magento 2 product attributes are to:

  • Define product information
  • Use for filtering and searching
  • Use to compare products in reports
  • Use for promotion settings up

Two Types of Product Attributes Magento 2

Please navigate to Admin Panel ⇒ Stores ⇒ Attributes ⇒ Product.

All product attributes in Magento 2 are saved in one grid for easy management where you can search and edit any attributes at hand.

If you visit for the first time, you can see many built-in attributes. They are unchangeable system attributes.

Besides, you can create new attributes, called Magento 2 custom attributes, according to your management purposes.

product attributes in magento 2 - grid

>>> READ IT NOW: Customer Attributes & Registration – The Perfect Combo For B2B

Create A Custom Magento 2 Product Attributes List

There are 2 ways to add new product attributes in Magento 2:

  • When working on a specific product edit page (*)
  • From the Product Attributes page

(*) Let’s discuss the next post about the Product workspace. Here we talk about how to add new attributes from the Magento 2 Product Attributes page.

Step 1: Click on “Add New Attributes”

Step 2: Properties tab

Under Attribute properties, describe basic information of the product attributes Magento 2.

product attributes magento 2-properties

The Catalog Input Type will define the type of data that can be entered in the fields. There are 12 Catalog Input Types to define the product attributes Magento 2.

  • Text Field: A single-line field to enter text
  • Text Area: A multiple-line field to enter text directly or using  WYSIWYG Editor
  • Text Editor: Add WYSIWYG Editor to any custom field
  • Date: Date & Time can be picked from the calendar or typed directly into a field
  • Yes/No: A “switch” button between two pre-defined options: Yes or No
  • Dropdown: A drop-down list to choose one option at a time
  • Multiple Select: Used to create price fields. The currency used is determined in the system configuration
  • Media Image: A media image attribute becomes an additional image type, along with Base, Small, and Thumbnail
  • Fixed Product Tax: Used to define FPT rates based on the locale requirements
  • Visual Swatch: For configurable products, the corresponding image is shown per swatch on the visual option (e.g color)
  • Text Swatch: For configurable products, the corresponding image is shown per swatch on the text option (e.g size)

Expand Advanced Attribute Properties. You can skip this part since all fields are optional.

product attributes magento 2-advanced-customer-attributes

*Notes:

  • Attribute code: the unique identifier to manage the attribute: search, import/export, get attribute ID/name/value, etc.
  • Scope: Decide how the attribute value is displayed and edited based on a specific level: Global ⇒ Website ⇒ Store View
    • Global: The value of the attribute is shared by all websites and store views.
    • Website: The value varies per website but stays the same for multiple store views under that website.
    • Store View: Tailor different values per store view, primarily based on the languages.
  • Set Unique Value to Yes to prevent duplication. Recommended for ID-number fields like SKU.
  • Attributes used for the configurable products must have Catalog Input Type to be drop-down and the Global scope.

Step 3: Manage Labels of Product Attributes Magento 2 (Optional)

The label is to identify the attribute in Admin and in the storefront of each store view. It makes sense if the scope of the attribute is “Store View”

magento 2 product attributes list- Manage Lable of attribute per storeview

Step 4: Set up Storefront Properties (Optional)

You can decide how the attribute can be used in the storefront and in the admin: for search & sorting; in layered navigation; for price rules, or in product comparisons.

product attributes magento 2 - storefront properties

>>> CLICK AND GET: Magento 2 Import Export Product Attributes

Magento 2 Attribute Set

An attribute set refers to a list of attributes related to a specific product family.

When creating new attributes, you can use the available attribute set or create new ones.

However, products under one category often share similar attributes. At that time, you had better organize shared attributes into sets and use them as templates for products. Such templates are attribute sets. To create a new attribute set, please follow Stores ⇒ Attributes ⇒ Attribute Sets ⇒ Add Attribute Set.

*Notes:

  • You should plan a correlative set in advance. Once you assign that set to a product, you can not change
  • Based on: Choose an existing attribute set that has a similar list of attributes
  • You can add or remove the attribute from the set by a drag-and-drop action.

FAQs about Product Attributes in Magento 2

How to get the attribute of a product?

There are many cases where you want to get values of product attributes in Magento 2, but the default reports are not informative enough.

If you are tech-savvy, you can simply use getCustomAttribute()

if (null !== $product->getCustomAttribute('your_custom_attribute')) { echo $product->getCustomAttribute('your_custom_attribute')->getValue(); }

How to import Magento 2 product attributes list?

For those who are not familiar with PHP code, you can use the BSS eCommerce Magento 2 addons. It allows exporting all or specific attribute sets via CSV file in several clicks.

Export-product-attributes-Magento-2

How to change the attribute scope?

For some reason, you want to change the scope of attributes, for example from Global to Websites. Unfortunately, those Magento 2 product attributes are not available in the Attribute grid. In that case, make changes in the database.

Create an upgrade script with this code:

$setup->updateAttribute('catalog_category', 'menutopdescription1', 'is_global', Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE);

Thanks, Marius in Stackexchange for this solution. We have tested it and it works well.

>>> Explore Magento 2 Custom Product Attribute Export

How to add a custom attribute to the customer registration form?

Please make clear Magento 2 attributes. In fact, they are Magento 2 product attributes – They are used to define product characteristics. If you want to add a custom attribute to the customer registration form, you can’t do it with Magento Community default features. Instead, use the Magento Customer Attribute module which helps you to do so.

>>> GET the most straightforward tutorial: How To Add New Magento 2 Product Attributes

How to apply promotion rules to items that feature a specific attribute value?

Magento 2 attributes can be used to set specific conditions for catalog/shopping cart price rules to trigger actions when the required conditions are met, for example:

  • Offering a discount on a particular product
  • Offering free shipping for orders above a certain amount
  • Scheduling a promotion for a time span.

Navigate Admin >  Marketing > (Promotions) Catalog Price Rules > Add New Rule to use this functionality. Remember that you must set the Use for Promo Rule Conditions to “Yes” (under the Storefront Properties tab of such Magento 2 attribute’s configuration panel) to allow using attributes for promotion rule conditions.

In the example below, the promotion rule is applied to blue items that belong to categories 20, 21, and 23.

catalog-price-rule-with-magento-2-attributes

promotion-rules-with-magento-2-attributes

>>> You can explore the foundational knowledge about Magento in the following article: Magento 2 Tutorial for Beginners

Wrapping Up

We have covered all about Magento 2 product attributes list in brief for your easy reference. If you have any questions, please let us know.

Assign products to categories automatically based on product attributes with Magento 2 Dynamic Category!

BSS Commerce is one of the leading Multi-platform eCommerce solution providers and web development services in the world. With experienced and certified Magento developers, we commit to bringing high-quality products and services to optimize your business effectively.

CONTACT NOW to let us know your problems. We are willing to support you every time.

Next Reading Suggestions

© 2019 BSS Commerce owned by THANH CONG INTER ., JSC. All Rights Reserved.
Business registration certificate no. 0106064469 issued by Hanoi Department of Planning and Investment on 19 December 2019.
Legal Representative: Mr. Nguyen Quang Trung.