How Do I retrieve / update Function Metafields through GraphQL queries

Shopify Partner
35 0 3

I am trying to add user configuration to a Shopify Discount Function. The Remix / React example does not work, when you try and add the components, error city:




Ok, use the legacy deps flag:




Which hosed the app completely when trying to shopify app deploy (or dev):




Isn't there a simpler way to do this, by just using an app to retrieve the existing metafields of a function, and then update them? I can do that in Rails, Sinatra, easy if I had the queries and avoid the React stuff. Just one user will be using the configuration at a time so I am not worried about performance.


This query just gives a "bad request" response but in Graphql it works:


curl -X POST \ \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: from_shopify-env-file' \
-d '{
"query": ""query DiscountAutomaticNodeMetafields($ownerId: ID!) {
                    discountNode(id: $ownerId) {
                      metafields(first: 7) {
                        edges {
                          node {
                    "ownerId": "gid://shopify/DiscountAutomaticNode/123456"

Is there any way to query and update the metafields of a function OUTSIDE Graphql, that is what I am asking and I can forget about React and what node library is nuking javy for now.


[I have another copy of this shopify function in Github but without the Remix template. Function worked until I tried adding the React components and had to use the "--legacy-peer-deps" flag.


Just trying to get this into production.



Replies 0 (0)