Metafield and metaobject triggers

Custom data is often where a store's real logic lives: a loyalty tier on the customer, a supplier code on the product, a size chart as a metaobject. These triggers start a workflow when that data changes, with the value before and after.

Metafield triggers

One trigger per resource. You choose the metafield in the trigger panel.

Trigger How the change is found
Product metafield changed With the product's update event, within seconds
Collection metafield changed With the collection's update event
Order metafield changed With the order's update event
Customer metafield changed With the customer's update event
Company metafield changed, Company location metafield changed With the update event
Product variant metafield changed Shopify sends no event for variant metafields. The whole catalogue is exported and compared every 5 minutes, so it can arrive several minutes after the change, longer on a large catalogue
Blog metafield changed, Blog post metafield changed, Page metafield changed Shopify sends no event. The store is checked every 5 minutes

Set it up

  1. Choose the trigger, for example Product metafield changed.
  2. In the trigger panel, open Metafield and pick one of your store's metafield definitions. For a metafield without a definition, type its namespace and key.
  3. Save and turn the workflow on.

A workflow with an empty metafield cannot be turned on. Each store can watch up to 25 metafields per trigger.

What the event carries

  • event.payload.metafield with value, previous_value, typed_value, previous_typed_value, type and change (whether it was created, changed or removed).
  • event.changes.items with one entry: field metafield_value, oldValue and newValue.

Use the field metafield_value in a before-and-after rule. Values are compared as Shopify's text, so increased and decreased work on number metafields.

Example: tag a customer when the metafield loyalty.tier changes to gold. Trigger Customer metafield changed, filter rule: field metafield_value, changed to, value gold. The template Tag customers by a loyalty metafield does this.

Metaobject triggers

Trigger Starts when
Metaobject entry created An entry of the metaobject you choose is created
Metaobject entry updated An entry changes. The event lists every field that changed, with the value before and after
Metaobject field changed ONE field of an entry changes, with the value before and after
Metaobject entry deleted An entry is deleted

Set it up

  1. Choose the trigger.
  2. In the trigger panel, pick the Metaobject. The list shows your store's metaobject definitions; it needs the permission to read metaobject definitions.
  3. For Metaobject field changed, also pick the Field.

In a before-and-after rule, Metaobject entry updated uses the field's key, and Metaobject field changed uses field_value.

Good to know

  • A metafield written by your own workflow comes back as an event. Loop protection recognises that echo. See Loop protection.
  • The variant metafield trigger uses one of your store's bulk operation slots for a short time in each cycle. If the slot is busy, the check waits for the next cycle.
  • Order, customer and company triggers need Shopify's approval for protected customer data. See Permissions and store data access.
  • To write a metafield from a workflow, use the ready-made actions Set product metafield, Set order metafield and Set customer metafield. See Ready-made Shopify actions.