Is this a small set of products or a lot of products?
Topic summary
The discussion centers on updating product metafields that reference metaobject entries using Shopify Flow, specifically when new products are added.
Initial Challenge:
- User wanted to automatically assign different metaobject entries to products based on product type (e.g., Entry A for Type A, Entry B for Type B)
- No clear way to select specific metaobject entries in Flow’s interface
Solution for Single Metaobject References:
For small product sets, the “Update product metafield” action works by:
- Setting type to “Metaobject”
- Entering the GID directly in value field:
gid://shopify/Metaobject/123 - Finding the ID in the metaobject entry’s URL
- Avoiding spaces/newlines in the value
Solution for List of Metaobjects:
A more complex scenario emerged involving metafields containing lists of metaobjects (like materials). The working solution requires:
- Using the “Run Code” action to generate an array of GIDs
- Converting the set to JSON string format:
["gid://shopify/Metaobject/123","gid://shopify/Metaobject/456"] - Passing this output to “Update product metafield” action
Status: Resolved with working examples and code snippets provided for both scenarios. Community members confirmed solutions worked and shared helpful GitHub resources for Flow code examples.