Magento 2 Product Attributes 101 – Know Clearly to Use Properly

Magento Product Attributes

Magento 2 Product Attributes 101 – Know Clearly to Use Properly

Magento 2 attributes are the materials to build the product characteristics so that customers can buy 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 system attributes, which are unchangeable.

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

product attributes in magento 2 - grid

KNOW WHAT? You can add an additional attributes, call Magento 2 Customer Attribute to understand your customers more.

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 visual option (e.g color)
  • Text Swatch: For configurable products, the corresponding image is shown per swatch on 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

Magento 2 Attribute Set

When creating a new product, you can use available attributes or create new ones.

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

magento-2-attribute-sets

*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 which 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 that 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 BSS Commerce solution. It allows exporting all or specific attribute sets via CSV file in several clicks.

Export-product-attributes-Magento-2

GO TO BUILT-IN EXTENSION NOW >>> Import/Export Magento 2 Product Attributes. It ensures all data to be proceeded right!

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 and it works well.

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

Please make clear of 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 Magento 2 Customer Attribute extension which helps you to do so.

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 AdminMarketing > (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 Storefront Properties tab of such Magento 2 attribute’s configuration panel) to allow using attributes for promotion rule conditions.

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

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

promotion-rules-with-magento-2-attributes

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.

About BSS Commerce:

We are one of the leading Magento extension providers and web development services in the world. With experienced and certified Magento developers, we commit to bring high-quality products and services to optimize our business effectively. Let us know about your problems. We are willing to support you every time.

CONTACT US NOW for more information.

Write A Comment

Name