Metafields in Shopify Flow

Metafields are custom fields that you can use to add extra information to your products, customers, orders, and other objects in your store. Metafields can be used to store information that isn't included in the default fields of an object. For example, you can use metafields to store information about a product's manufacturer, a customer's birthday, or an order's delivery date.

When building a workflow, you might want to get or set metafield and metaobject data in your store.

Get metafield data in a workflow

Metafield data is different than other store data, or even other fields that require arguments, because each field is custom to your shop, and it can be a different type than other data in your store. Because of this, Flow needs to do extra work in order to make this data easy to access. This results in a different experience for you than simply selecting a field in the environment, such as product.title.

Steps:

  1. In a Shopify Flow workflow, click Add a variable in an action or condition.
  2. Select the resource where the metafield is stored, such as product, customer, or order.
  3. Choose metafield from the list of fields to create a variable. Don't choose metafields (plural), as this provides a list of all metafields.
  4. In the Create variable dialog, do the following steps:
    1. In the Metafield menu, select the metafield from the list of structured metafields, or click Use an unstructured metafield to use the namespace and key for an unstructured metafield.
    2. Make a note of the Variable name provided.
    3. Click Add to refresh the variable selection panel.
  5. Choose the metafield variable that you want to use. In some cases, this will simply be value.

After adding a metafield to a workflow, the metafield remains available as a variable option and you can quickly reference it in subsequent steps. When choosing to Add a variable, it displays nested beneath the relevant metafield option in the list of fields.

Update metafield values

Flow provides the following actions to update metafield values:

Create metafield definitions

You can create metafield definitions in workflows by using the Create metafield definition action. This is useful when you want to add metafields to resources that don't already have them.