-
-
Save danyn/6654d1af55a72521f0f5eee62edd6e0f to your computer and use it in GitHub Desktop.
getShopMetafieldsByNamespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query GetShopMetafieldsByNamespace($namespace: String!) { | |
shop { | |
metafields(namespace: $namespace, first:50) { | |
nodes { | |
id, | |
value | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Put a metafield on any resource must be configured with the resource gid ex(shopGid, productGid etc...) | |
MetafieldsSetInput: https://shopify.dev/api/admin-graphql/2022-04/mutations/metafieldsSet#returns | |
field = { | |
"key": "", | |
"namespace": "", | |
"ownerId": "resourceGid", | |
"type": "", | |
"value": "" | |
} | |
variables: { | |
metafields: [field1, field2], | |
}, | |
""" | |
const PUT_METAFIELDS = ` | |
mutation metafieldsSet($metafields: [MetafieldsSetInput!]!) { | |
metafieldsSet(metafields: $metafields) { | |
metafields { | |
key | |
namespace | |
value | |
createdAt | |
updatedAt | |
id | |
} | |
userErrors { | |
field | |
message | |
code | |
} | |
} | |
} | |
`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment