Skip to main content
The catalog workflows emit 6 events as attributes and values change. Subscribe to them to reindex storefront facets, sync an external product information system, or start your own workflows. The event names are exported as ProductAttributeWorkflowEvents and ProductAttributeValueWorkflowEvents from @mercurjs/core/workflows.

Attribute events

Each event fires once per attribute, with that attribute’s id as the payload.

Value events

Each event fires once per value, with that value’s id as the payload.

What doesn’t emit

Some writes create or change records without a matching event:
  • Values created with an attribute: createProductAttributesWorkflow emits only product-attribute.created, not a value event per value
  • Upserts: upsertProductAttributeValuesWorkflow emits nothing
  • Attaching and detaching: linking values to a product, text and unit values created on attach, and option changes on a product emit no attribute events

Subscribe to an event

A subscriber receives one event per attribute. Resolve query to load the record by id.
src/subscribers/product-attribute-created.ts
The subscriber loads the new attribute with its values. Swap the log line for a call to your search index.