Update product metafield

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

Fields

The Update product metafield action contains the following fields.

Fields used in the update metafield action.
FieldDescription
Metafield namespaceRequired. A metafield namespace is a container for a group of metafields. Grouping metafields within a namespace prevents your metafields from conflicting with other metafields.
KeyRequired. A key is an identifier for the metafield value.
ValueRequired. 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.
TypeThe data type of the metafield's value.

For details on what format is required for each value and type, consult the metafields documentation.

Triggers

The Update product metafield action requires a field, Product ID, that identifies the product to add a metafield to. The product ID is set by default and can't be changed. The Update product metafield action can be used in workflows that start with the following triggers:

API details

To learn more, review the MetafieldInput input object.

Templates

Convert tags with a prefix to a product metafield using the Run code action

This workflow will take tags that start with a prefix such as 'color:' and add them to a product metafield list. It uses the Run code action to parse the tags and existing items in the metafield list. The workflow runs when a product is created, but can be manually run on existing products. View template

Tag and organize new products by title

Standardize tagging, merchandising, and care instructions for new products based on product title. View template

Track product variants that are on sale using a product metafield

Sets a metafield on a product if at least one of its variants is on sale. This can be useful for tracking which products are currently on sale. View template

Update a product metafield if a product tag has a certain prefix

When a product is added to store, check if any product tags contain "prefix_" and then add the rest of the tag as a product metafield. View template

Can’t find the answers you’re looking for? We’re here to help.