Skip to main content

How to use customer metafield data in Shopify Flow workflows

Learn how to get, set, and update customer metafield data in Shopify Flow workflows connected to Seguno Email Marketing.

Customer metafields are custom fields that store extra information on customer records beyond Shopify's default fields. In Shopify Flow, you can read and write customer metafield data as part of a workflow, which is useful when building automations that connect to Seguno Email Marketing.

For example, you might check a customer's loyalty tier metafield and use that value to trigger a targeted email send.

Note:

Customer metafields work differently from standard customer fields because they are custom to your store and can have different data types. Shopify Flow requires you to create a variable for the metafield before you can reference it in conditions or actions.


Create a metafield definition for a customer

If the customer metafield you want to use does not exist yet, you need to create its definition before the workflow can reference it.

  1. Open your Shopify admin and open Shopify Flow.

  2. Create a new workflow or open an existing workflow.

  3. Select the trigger that should start the workflow.

  4. Click Add action and select the Create metafield definition action.

  5. Select Customer as the resource.

  6. Configure the metafield definition with a name, namespace, key, and data type.

  7. Click Save to make the metafield available for use in the workflow.


Get customer metafield data in a workflow

Once a metafield definition exists, you can create a variable for it and reference that variable in conditions and actions.

  1. In a condition or action in your workflow, click Add a variable.

  2. Select customer as the resource.

  3. Select metafield from the list of fields.

    1. Note: Do not select metafields (plural). The plural option returns a list of all metafields on the resource and cannot be used the same way as a single metafield variable.

  4. In the Create variable dialog, open the Metafield menu and select your customer metafield from the list of structured metafields. If your metafield is unstructured, click Use an unstructured metafield and enter the namespace and key directly.

  5. Note the variable name shown in the dialog.

  6. Click Add to refresh the variable selection panel.

  7. Select the metafield variable you want to use. In most cases, select value.

After you add a metafield variable, it stays available in subsequent steps. When you click Add a variable again, it appears nested under the relevant metafield option for quick reuse.


Use a customer metafield in a condition

  1. Click Add condition in your workflow.

  2. Select the customer metafield variable you created.

  3. Compare the variable against the value you want to check.

  4. Add the actions that should run when the condition is met.


Update a customer metafield

  1. Click Add action and select the Update customer metafield action.

  2. Select the metafield by name from the list, or enter the namespace and key for an unstructured metafield.

  3. If you are using an unstructured metafield, enter the namespace, key, and data type.

  4. Enter the value you want saved to the customer metafield. Warning: Make sure the value matches the metafield's data type. A type mismatch will cause the workflow to error.


Example

A skincare merchant stores each customer's loyalty tier in a customer metafield called loyalty_tier with values of bronze, silver, or gold. In a Shopify Flow workflow, they follow the steps above to create a variable for customer.metafield using the loyalty tier field. They add a condition that checks whether the value equals gold, then connect that branch to a Seguno Email Marketing automation that sends a VIP offer email to qualifying customers.


Common errors

Issue

Cause

Solution

Metafield not appearing in the list

Metafield definition does not exist in your store

Create the metafield definition first (see Create a metafield definition for a customer)

Variable returns no value

Selected metafields (plural) instead of metafield (singular)

Clear the variable and repeat the steps, selecting the singular option

Workflow errors after update step

Value entered does not match the metafield's data type

Verify the metafield type in your Shopify admin under Settings > Custom data and re-enter a matching value

Unstructured metafield value is empty

Namespace or key was entered incorrectly

Confirm the exact namespace and key under Settings > Custom data in your Shopify admin


FAQs

What is the difference between a structured and an unstructured metafield in Shopify Flow?

  • A structured metafield has a named definition in your Shopify admin and appears in the metafield selection list automatically.

  • An unstructured metafield is identified by a namespace and a key, and you enter those values manually when creating the variable.

Why do I need to create a variable before using a metafield in a condition?

  • Shopify Flow requires a variable creation step for metafields because each metafield is custom to your store and may use a different data type than standard fields. Creating the variable tells Flow how to read the data.

Can I reuse a customer metafield variable in multiple steps?

  • Yes. Once you add a metafield variable, it remains available throughout the workflow. When you click Add a variable again, it appears nested under the relevant metafield option in the field list.

Did this answer your question?