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.
On this page
Fields
The Update product metafield action contains the following fields.
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 other metafields. |
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. |
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:
- Product added to store
- Product status updated
- Product variant added
- Inventory quantity changed
- Variant back in stock
- Variant out of stock
- Inventory item created
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