Magento eav attributes

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

Magento eav attributes is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. Work with Magento 2 EAV (Entity-Attribute-Value) system — create custom attributes, attribute sets, manage EAV tables, and understand the EAV data model. Use when adding product/category/customer attributes or working with the attribute system.

How to use this skill

Skill file

Magento 2 EAV & Attributes

Before writing code

Fetch live docs:

  1. Web-search site:developer.adobe.com commerce php development components attributes for attribute development guide
  2. Web-search site:developer.adobe.com commerce php tutorials backend custom-attributes for attribute creation tutorial
  3. Web-search magento 2 EAV attribute data patch for current patterns using data patches

Conceptual Architecture

What EAV Is

Entity-Attribute-Value is Magento's flexible storage pattern. Instead of one column per attribute, values are stored in separate typed tables. This allows merchants to add unlimited attributes without schema changes.

EAV Entities

Four entity types use EAV:

EAV Table Structure

Each entity has typed value tables:

Attribute Properties

Key properties when creating attributes:

Attribute Sets and Groups

Creating Attributes via Data Patch

The modern approach uses Data Patches with EavSetupFactory:

  1. Create a data patch class in Setup/Patch/Data/
  2. Inject EavSetupFactory (or CategorySetupFactory for categories)
  3. Call $eavSetup->addAttribute() with entity type, code, and properties
  4. Assign to attribute set/group

Source Models

For select/multiselect attributes, source models provide options:

Static Attributes

Attributes with type static are stored as columns directly on the entity table rather than in EAV value tables. Used for frequently queried fields (e.g., sku, type_id, created_at).

Best Practices

Fetch the attribute development docs for exact addAttribute() parameters, source model patterns, and current entity type constants before implementing.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.