Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Re: Metaobjects in Shopify Flow

When will Shopify Flow support metaobjects?

excaelest
Shopify Partner
2 0 2

When will metaobjects be supported in Shopify Flow?

Replies 20 (20)

paul_n
Shopify Staff
1433 157 332

How are you looking to use metaobjects with Flow?

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
excaelest
Shopify Partner
2 0 2

I use Flow to continuously count the total number of trees planted as a result of items purchased. Currently, the value is stored in a shop metafield (shop.metafields.mission.trees). I want to instead store it in a metaobject so that the client can adjust it if need be.

paul_n
Shopify Staff
1433 157 332

We don't have an action for this yet, but in the meantime you could use Send HTTP Request to call the Shopify API to Update or Upsert a metaobject:

https://shopify.dev/docs/api/admin-graphql/2023-04/mutations/metaobjectUpsert

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Not applicable

Just want to chime in and say this action would be very useful for me as well. Instead I'm going to have to build a whole custom app to do something that could be accomplished with a simple trigger/action in shopify flow

paul_n
Shopify Staff
1433 157 332

Can you elaborate more on what you would want to do with metaobjects in Flow?  

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
jessie_monument
Shopify Partner
13 0 10

@paul_n it would be useful for me in this case:
we are using metaobjects to group related products in a "variant group" so we can display links to products that look like variant selectors on the product page. It would be nice if Flow could handle an automated function where if a product is PLACED in a metaobject list, the product is automatically assigned a product metafield for that group so the shopify admin doesn't have to do two steps. Right now they have to add the product to the metaobject list and then go into each product and add the metaobject to the product (since there is no way to reference a a metaobject if it isn't assigned).

RPiii
Shopify Staff
92 16 33

We recently released a Metaobject entry created trigger that should make it easier to trigger workflows when new entries are created on a metaobject definition. 

gary07
Excursionist
65 0 11

Hi Paul,

I am using metaobjectUpsert  so it creates or updates the meta object

 

Getting error I have added all required fields on this 

 

https://shopify.dev/docs/api/admin-graphql/2024-01/input-objects/MetaobjectUpsertInput

 

 

 

 

Send Admin API request
Attention
Early Access
25 Jul 2024 at 17:50
Mutation input evaluated to invalid JSON. Please ensure the input forms are valid JSON after the Liquid code is run.
metaobjectUpsert evaluated input may be handel I am using incorrectly?


{
"handle": {
"type": "text",
"handle": "Hoover-freestanding-fridge-freezers"
},
"metaobject": {
"handle": "Hoover-freestanding-fridge-freezers",
"fields": [
{
"key": "or_see_more_choices.vendor_category_title",
"value": "Hoover Freestanding Washing Machine"
}
],
"capabilities": {
"publishable": {
"status": "ACTIVE"
},

}
}
}

paul_n
Shopify Staff
1433 157 332

put that JSON in a JSON validator tool like this https://jsonlint.com/

 

Trailing commas are not allowed

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
gary07
Excursionist
65 0 11
Hi

Removed trailing comma

But still same error
paul_n
Shopify Staff
1433 157 332

You may have more in your mutation than you copied here. I don't think whitespace should matter, but try copying exactly what is in that action now and sharing here using the code sample feature </>. Also share the error message. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
gary07
Excursionist
65 0 11
hi

[image: image.png]
gary07
Excursionist
65 0 11

Hi Paul

 

Sorry don't know why the image wasn't attached

 

gary07_0-1721980271700.png

 

paul_n
Shopify Staff
1433 157 332

I don't know what error your are getting, but I just ran a test with this and it worked:

{
  "handle": {
    "type": "recipe",
    "handle": "scrambled-eggs"
  },
  "metaobject": {
    "handle": "scrambled-eggs",
    "fields": [
      {
        "key": "ingredients",
        "value": "[\"eggs\",\"milk\"]"
      }
    ]
  }
}

 It's possible your handle is not a valid handle, if it has something like spaces/symbols in it. Or maybe your type isn't correct. Or the key isn't right.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
paul_n
Shopify Staff
1433 157 332

FYI, the key seems to only accept "ingredients" and not "recipe.ingredients" so you may need to remove that first part of your key as well. When I have the full key, I get:

 
Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
webb1
Shopify Partner
6 1 0

I also have a need for this and interacting with the API is a lame "resolution" to this problem 

paul_n
Shopify Staff
1433 157 332

A need for what? If you are referring to the ability to update a metaobject, we have no plans to offer a dedicated task for this currently as the solution in steps would be more difficult to use, because you need to handle programmatically building a list of fields to insert, and because each metaobject is completely unique so we could need to auto-generate a UI anyway and that would also be clunky.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
webb1
Shopify Partner
6 1 0

not the metaobject but a field inside the metaobject 

newyarektimes
Shopify Partner
2 0 2

+1

Use case: I have a ssg frontend and I would like to trigger a build when metaobjects are updated.

pRoy
Excursionist
10 1 3

+1 for this!