> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mercurjs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Attributes

> Describe the shared catalog with typed attributes, turn them into variant axes, and expose them as storefront filters.

Use attributes to give every product in your marketplace the same typed vocabulary, from sizes and materials to capacities and yes/no flags.

An attribute is a typed field that operators define once and attach to products in the shared master catalog. It describes products the same way across every store, feeds storefront filters, and, when it’s a variant axis, decides which variants a product can have. The Product Attribute module holds the attributes and their values. Links connect them to Medusa’s products, categories, and product options, so a variant axis is a real Medusa `ProductOption` underneath.

![The global attribute catalog lists Size, Material, Thread count, Gift wrap, and Care with their types, and Size is the one variant axis, backed by the global Medusa product option Size behind it.](https://mintcdn.com/mercur/KNc3NtbZ9cUlitbx/images/figures/attribute-overview-light.svg?fit=max\&auto=format\&n=KNc3NtbZ9cUlitbx\&q=85\&s=f625ba675277c8aa85f95de9ac384fe1)

> [!NOTE]
>
> The data models are `ProductAttribute` (id prefix `pattr`) and `ProductAttributeValue` (id prefix `pattrval`), resolved with `MercurModules.PRODUCT_ATTRIBUTE` from `@mercurjs/types`. Attributes belong to the catalog, never to a store.

## Key features

The Product Attribute module covers the full life of a catalog attribute:

* **Five types**: `single_select`, `multi_select`, `text`, `unit`, and `toggle`, each storing its values differently
* **Variant axes**: a `multi_select` attribute with `is_variant_axis` creates a Medusa `ProductOption` that variants bind to
* **Global or inline**: define an attribute once for the whole catalog, or create a one-off attribute on a single product
* **Category scoping**: link an attribute to product categories so it’s offered only for products in them
* **Storefront filters**: shoppers filter products by axis values, and `is_filterable` tells your storefront which attributes to show as facets
* **Internal attributes**: `is_internal` keeps an attribute operator-only, hidden from stores and the storefront
* **One batch workflow**: attach, detach, and update all of a product’s attributes in a single run
* **Hooks and events**: catalog workflows expose hooks and emit `product-attribute.*` and `product-attribute-value.*` events

## How it works

An attribute reaches a product in four steps:

1. An operator runs `createProductAttributesWorkflow`. For a variant axis, it also creates a global `ProductOption` with the same values.
2. A product is created with Mercur’s `createProductsWorkflow`, or edited with `createAndLinkProductAttributesToProductWorkflow`, and picks the attributes and values it uses.
3. Selected values link to the product. For an axis, the product also gets the option with only the selected subset of values.
4. Variants bind to the axis option by its title, for example `{ Size: "M" }`, and the storefront filters products by those option values.

## Get started

Learn how attributes, values, and axes fit together.

> [card] [Attribute types](https://docs.mercurjs.com/platform/attribute/concepts/attribute-types.md)
>
> The five types and how each one stores its values.

> [card] [Variant axes](https://docs.mercurjs.com/platform/attribute/concepts/variant-axes.md)
>
> How an axis attribute mirrors a Medusa `ProductOption`.

> [card] [Global vs inline](https://docs.mercurjs.com/platform/attribute/concepts/global-vs-inline.md)
>
> Catalog attributes, product-scoped attributes, categories, filters, and internal attributes.

## Examples

Build against attributes in your own server code.

> [card] [Create an attribute](https://docs.mercurjs.com/platform/attribute/guides/create-an-attribute.md)
>
> Run `createProductAttributesWorkflow` from a route or seed script.

> [card] [Attach to a product](https://docs.mercurjs.com/platform/attribute/guides/attach-attributes-to-a-product.md)
>
> Attach, detach, and update a product’s attributes in one run.

> [card] [Create a variant axis](https://docs.mercurjs.com/platform/attribute/guides/create-a-variant-axis.md)
>
> Create an axis and build a product’s variants on it.

## Resources

The data models, links, workflows, service methods, and events behind attributes.

> [card] [Data models](https://docs.mercurjs.com/platform/attribute/reference/data-models.md)
>
> `ProductAttribute` and `ProductAttributeValue`, field by field.

> [card] [Links](https://docs.mercurjs.com/platform/attribute/reference/links.md)
>
> Links to products, categories, and product options.

> [card] [Workflows](https://docs.mercurjs.com/platform/attribute/reference/workflows.md)
>
> Catalog workflows and product attachment workflows.

> [card] [Service](https://docs.mercurjs.com/platform/attribute/reference/service.md)
>
> Module service methods for working with records directly.

> [card] [Events](https://docs.mercurjs.com/platform/attribute/reference/events.md)
>
> Events emitted as attributes and values change.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.