Add product variant metafield

The Add product variant metafield action adds a metafield to the product variant that triggers the workflow, or updates an existing metafield on that product variant.

Fields

The Add product variant metafield action contains the following fields.

Fields used in the Add product variant metafield action.
Field Description
Metafield namespace Required. A metafield namespace is a container for a group of metafields. Grouping metafields within a namespace prevents your metafields from conflicting with others.
Key Required. A key is an identifier for the metafield value.
Value Required. The value is the information to be stored in the metafield. The value is always stored as a string, regardless of the metafield's type.
Type The data type of the metafield's value.

Triggers

The Add product variant metafield action has hidden fields added to it by the trigger. These fields, Product ID and Product variant ID, identify the product and product variant to add a metafield to. The product ID and product variant ID are set by default and can't be changed.

The Add product variant metafield action can be used in workflows that start with the following triggers:

  • Inventory quantity changed
  • Product variant added

Example

Example of a workflow that adds a product variant metafield when the inventory quantity is equal to or less than zero

In this example workflow, a product variant metafield is added to a product variant when its inventory quantity is equal to or less than zero.

API details

To learn more, review the MetafieldInput input object.

Ready to start selling with Shopify?

Try it free