Metafield triggers by resource typeInventory transfer metafield trigger

Inventory transfer metafield trigger

Copy page

Start a Shopify Flow workflow when an inventory transfer metafield changes. Track it in Workflow Trigger Extensions and get the old and the new value.

A merchant moves stock between warehouses and writes the tracking reference of the haulier into the transfer metafield Carrier reference (custom.carrier_reference). As soon as it is filled in, the receiving warehouse should get it.

This page shows how to start a Shopify Flow workflow whenever a metafield of an inventory transfer changes, with Workflow Trigger Extensions. The steps are the same for every metafield of this resource type; the example uses Carrier reference (custom.carrier_reference).

What you need

  • A metafield definition. Create it in your Shopify admin under Settings > Metafields and metaobjects > Transfers. A metafield without a definition cannot be tracked.
  • The permission Inventory Transfers Data Access. Grant it on the app's Permissions page, see Permissions and data access.

1. Track the metafield

  1. Open Metafield Triggers in the app and click Add trigger.
  2. Choose the resource type Transfer.
  3. Tick the metafield, here Carrier reference. You can tick several at once or use Select all.
  4. Click Add trigger.

To track every metafield of this resource type, including the ones you create later, choose All metafields instead of ticking single ones, then click Track all metafields.

The Add Metafield Trigger dialog with resource type Transfer and the metafield Carrier reference, custom.carrier_reference, ticked
Resource type Transfer, the metafield ticked. All metafields tracks every metafield of the type instead.

The trigger is Active at once. The first time the app reads an inventory transfer, it stores the current value without starting a workflow; every change after that starts one.

If the metafield is missing from the list, click Refresh Metafields on the Metafield Triggers page: the app remembers the list of definitions for an hour.

2. What the workflow receives

Every change starts the trigger Metafield Update in Shopify Flow with these values:

Variable Value
resourceType TRANSFER
resourceId The ID of the inventory transfer, for example gid://shopify/InventoryTransfer/1234567890
metafieldKey Namespace and key, here custom.carrier_reference
metafield.value The new value
metafield.previousValue The value before the change, empty when the metafield was set for the first time
metafield.type The type of the metafield, for example single_line_text_field

3. Build the workflow

  1. In Shopify Flow, create a workflow and choose the trigger Metafield Update of Workflow Trigger Extensions.
  2. Add a Condition: resourceType is equal to TRANSFER. Metafield Update starts for every resource type you track, so the condition keeps this workflow to inventory transfers. When you track several metafields of the type, add metafieldKey is equal to custom.carrier_reference as a second criterion.
  3. Add the action you need. The example sends an internal email with the old and the new value.
The example workflow in Shopify Flow: Metafield Update, a condition on resource type TRANSFER and Send internal email
The example workflow: the trigger, the condition on the resource type and one action.

Start from the example

  1. Download the .flow file attached at the bottom of this page.
  2. In your Shopify admin open Flow, click Import and choose the file.
  3. Open the Send internal email step and enter the recipient. The file holds no address on purpose.
  4. Turn the workflow on.

Make it yours

  • Add the condition "metafield.previousValue is empty" to react only when the reference is filled in for the first time.
  • Send the reference to the receiving warehouse's system with Send HTTP request.
  • Add a condition on metafieldKey when you track several transfer metafields.

How fast it reacts

Shopify sends no notification for this, so the app reads the tracked metafields about once a minute. Expect the workflow within a minute or two.

Good to know

  • Transfers created in the last 90 days are watched. A metafield changed on an older transfer starts no workflow.
  • A new transfer is first seen within about a minute. A value the metafield already has at that moment is its starting value and starts no workflow; every change after that does.

More