Automated metafields

Topic summary

A user is attempting to automate metafield population in Shopify by extracting values from product descriptions using Flow. The goal is to parse text like “Glass: Mineral glass” from descriptions and automatically populate corresponding metafields.

Key Technical Challenge:
The metafield uses a metaobject reference (not simple text), requiring updates via the Admin API’s metaobjectUpdate mutation rather than standard metafield actions.

Progress & Issues:

  • Initial attempts failed due to empty value fields and incorrect mutation syntax
  • User encountered variable validation errors when using metaobjectUpdate
  • After troubleshooting the field key (changed from “typ” to “glas”), the mutation executes without errors but values don’t populate in the product metafield—only in the metaobject itself under Content
  • Switching to multi-line text fields (simpler approach) isn’t viable because the metafield is used for product filtering, and 400+ products already have manually entered data

Current Status:
The discussion remains unresolved. The user needs a solution for automatically updating metaobject-based metafields while preserving existing data structure. String parsing (via Run Code action in JavaScript or Liquid) was suggested but implementation details for metaobject references are still unclear.

Summarized with AI on October 29. AI used: claude-sonnet-4-5-20250929.

Hello, I want to automate the Katecorgi metafields by writing a product description, and then I want the system to extract the values for the metafields from the description. I keep geting errors.

1 Like

It’s not clear what you want to do here and why you’ve left the value field empty when updating a metafield.

1 Like

I want to write a product description. For example:

Technical details
Glass: Mineral glass

When the system detects the value ‘Mineral glass’ in the description, I want it to automatically extract that value and place it in the metafield for ‘type of glass’.

Could you still help me? this is the errors. I also dont know what to put
in the value. i have already created a metafield and the values for that
metafield[image: Skärmavbild 2025-04-24 kl. 23.13.36.png]
[image: Skärmavbild 2025-04-24 kl. 23.13.58.png]

no image came through your post.

If it’s in the description, you need to do string parsing on the description. It really depends on how consistent your descriptions are, but probably I would use Run code on that as JavaScript has more tools for string parsing then Liquid. But Liquid might work as well.

Your metafield is a metaobject reference. You cannot change the values in a metaobject by updating the product metafield. Instead you would need to update the metaobject.

To do that, you would use “Send Admin API request” with the “metaobjectUpdate” mutation. You’ll need to set the JSON in that update.

1 Like

thanks for the help but i still get some errors. I tried with the metaobjectupdate and got this errors "Mutation had errors: “Variable $id of type ID! was provided invalid value”, “Variable $metaobject of type MetaobjectUpdateInput! was provided invalid value” {
“query”: “mutation metaobjectUpdate($input: MetaobjectUpdateInput!) { metaobjectUpdate(input: $input) { metaobject { id } userErrors { field message } } }”,
“variables”: {
“input”: {
“id”: “gid://shopify/Metaobject/170755064149”,
“handle”: “kristallglas”,
“fields”: [
{
“key”: “typ”,
“value”: “Kristallglas”
}
],
“capabilities”: {
“publishable”: {
“status”: “ACTIVE”
},
“onlineStore”: {
“templateSuffix”: “”
}
},
“redirectNewHandle”: false
}
}
}

It appears you are including fields that you really don’t need to update so it’s not clear which field this error is complaining about. Assuming that it’s they value field for your metaobject, you need to share more details about your metafield, specifically the types of each field.

1 Like

hello could you find the problem?

Your key for that field is either “glas” or “glas.glas” not “typ”

1 Like

As you can see in the SC everything works and i get no errors anymore but value in the metafield does not fills. the code: {
“id”: “gid://shopify/Metaobject/170755064149”,
“metaobject”: {
“handle”: “kristallglas”,
“fields”: [
{
“key”: “glas”,
“value”: “kristallglas”
}
],
“capabilities”: {
“publishable”: {
“status”: “ACTIVE”
}
},
“redirectNewHandle”: false
}
}

You aren’t updating a product metafield but a metaobject. If you go to “Content” in the Admin you should see what you updated.

So should i set a metafieldsSet mutation or please what should i do? Im useing a categori metafilds for my products

I don’t know because it’s unclear why you are using a metaobject at all if you just want a description. If that’s all you need, then create a product metafield that is multi-line text and use the “Update product metafield” action on it.


I still get error

i think i got it thanks