This article is produced by scandiweb

scandiweb is the most certified Adobe Commerce (Magento) team globally, being a long-term official Adobe partner specializing in Commerce in EMEA and the Americas. eCommerce has been our core expertise for 20+ years.

Magento Series: Working with Product Attributes

What are product attributes?

Attributes are properties that every product has and that which make them unique. They describe the products in terms of color, size, and other characteristics. Product attributes can be added, edited, and removed. Attribute sets are a list of attributes that can be used as templates for specific product types/groups.

Magento handles many different entity types (e.g., products, categories, customers) and uses the Entity-Attribute-Value (EAV) system.

How to manage product attributes in the admin area?

Attributes can be created or edited from the Product Attributes page. Here’s how to create product attributes from the Stores menu.

1. Setting product attribute visibility

Under the Attributes section, click on Products and then select or search for the attribute you want to make visible on the product detail page (PDP). In the Storefront Properties tab, look for “Visible on Catalog Pages on Storefront” and toggle the field to Yes.

To make the same product visible on the product detail page (PLP), set “Used in Product Listing” to Yes.

2. Working with the Create Attribute form

The following steps in creating product attributes are taken from the Adobe Experience League Catalog Management documentation.

  1. On the Admin sidebar, go to Stores > Attributes > Product.
  2. Click Add New Attribute
  3. Under Attribute Properties, enter a Default Label to identify the attribute.
  4. To determine the type of input control that is used for data entry, set Input Type

Available attribute input types:

Text FieldA single-line input field for text
Text AreaA multiple-line input field for entering paragraphs of text, such as a product description.
Text EditorA fully-functioning text editor at the attribute location.
DateDisplays a date value in the preferred format and time zone.
Date and TimeDisplays a date and time value in the preferred format and time zone. The date and time can be entered manually or selected from a calendar. Example format: MM/DD/YYYY HH:MM.
Yes/NoDisplays a drop-down list with pre-defined options of Yes and No.
DropdownDisplays a drop-down list of values that accepts only a single selection.
Multiple SelectDisplays a drop-down list of values that accepts multiple selections.
PriceThis input type is used to create price fields that are in addition to the predefined attributes: Price, Special Price, Tier Price, and Cost.
Media ImageAssociates an additional image with a product, such as a product logo, care instructions, or ingredients from a food label.
Fixed Product TaxLets you define FPT rates based on the requirements of your locale.
Visual SwatchDisplays a swatch that depicts the color, texture, or pattern of a configurable product.
Text SwatchA text-based representation of a configurable product option that is frequently used for size.
Page BuilderA fully-functioning Page Builder workspace at the attribute location that makes it easy to add engaging content to the product page.
Source: Adobe Experience League
  1. To set the values of all necessary attributes when creating a product set Values Required to Yes.

    This is the is_required flag for an attribute, if it is assigned to the attribute set of the product, each product will need to have the value defined. Otherwise, it will throw exceptions on save.
  2. For Dropdown and Multiple Select input types, do the following:
    • Under Manage Options, click Add Option.
    • Enter the first value that you want to appear in the list. You can enter one value for the Admin, and a translation of the value for each store view. If you have only one store view, you can enter only the Admin value and it will be used for the storefront as well.
    • Click Add Option and repeat the previous step for each option that you want to include in the list.
    • Select Is Default to use the option as the default value.
  1. Enter a unique Attribute Code in lowercase characters and without spaces. It is best to use ‘_’ instead of ‘-‘ in attribute codenames.

3. Entering the attribute label

  1. Click on Manage titles to expand it.
  2. Type in a Title that you’d like to use as a label for the field. You can input a translated title for each view if you have your store available in different languages. 

4. Assigning the created attribute to the attribute set and configuring advanced settings

Before an attribute can be used on a product, it needs to be added to the corresponding attribute set for that product. The attribute set defines which attribute values can be set on a specific product.

Product attribute properties dictate how an attribute can be used in the catalog, how it appears and behaves in the store, and when the data can be made available on the frontend.  

Where is the data for attributes stored in the database?

All products can be found in the catalog_product_entity table. This table only contains static attributes. Static attributes are system attributes that are stored directly on the table, and not in the catalog_product_entity_X tables. Default static attributes (some extensions add more) are sku, updated_at, created_at, has_options, required_options.

The eav_attributetable contains only the general data for all the attributes of all the EAV entities (category, product, customer, customer address, anything custom). But each EAV entity requires different data for their attributes. The values in catalog_eav_attributetable apply to products and categories attributes only.

Can product attributes be created programmatically?

Products are created programmatically with migration patches. A patch can create or update products when setup:upgrade is run and on deployment. We use a migration patch so that the changes to the database are executed on all environments, including everyone’s local environments. As opposed to adding manually to all environments and then asking others to update their local databases

Need help with Magento (Adobe Commerce) development? scandiweb is the most certified Magento team in the world—get your dedicated eCommerce growth team today or get in touch with one of our experts.

Need help with your eCommerce?

Get in touch for a free consultation to discuss your business and explore how we can help.

Your request will be processed by

If you enjoyed this post, you may also like